Re: what is my mistake
CuTe_Engineer wrote:
hii,
can you tell me plzz why my programme doesn`t work ,i don`t have any
errors and every thing is fine but i don`t know why it`s not
working ,
soo plz can you help me un finding my mistake
i will past the proramme here ,
<snip>
class Patient:public Gymnasium , public Nutrition,public Regime
{
public:
void set(string,int,string,int,string,double);
void get(string&,int& ,string& ,int&,string&,double&)const;
void print();
Patient(string= "",int=0,string="",int=0,string=0,double=0);
double calories(); // find the difference between gained & lost
calories and
//and sub. it from the energy
private:
person info;
Regime regimePlan;
};
<snip>
Public inheritance models an 'is-a' relationship between entities where,
generally, the derived class (eg Patient) is a specialised version of
the more general base class. The Patient declaration here effectively
states that a Patient is a kind of Gymnasium, is a kind of Nutrition and
is a kind of Regime. Obviously I don't have the specification for your
program, but in terms of Object-Orientated Design, the use of multiple
inheritance here doesn't strike me as a correct design choice.