Hi,
I am in process of creating a Money class, as per requirement I am suppose to represent each denomination by a class(eg: $5Class, $10Class etc.). I want to use inheritance in this scenario. I cannot think of the class design. I was able to create a class design for a denomination though as below. Can someone please help me creating a inherited structure of the same. below is my work so far:
Class FiveDoll{
private:
int val_five;
public:
FiveDoll(int v_fivedoll){ val_five = v_fivedoll; }
int GetFive() { return val_five; }
friend FiveDoll operator+(const FiveDoll &f1, const FiveDoll &f1);
};
FiveDoll operator+(const FiveDoll &f1, const FiveDoll &f1){
return FiveDoll(f1.val_five + f2.f1.val_five);
}
How can I create a hierarchy of currencies?