another question

C

CuTe_Engineer

hii,

////i have three headers

struct activities
{
string exercises;
int time;
};

class Gymnasium
{
protected:
activities gymarray[5];
int gymlength;
public:
void set(string,int);
void getActivities(string&,int&)const;
double calories();
void print();
Gymnasium(string, int );
};
++++++++++++++++++++++++++++++++++++
struct meals
{
string food;
int portion;

};

class Nutrition
{
protected:
meals nutritionarray[5];
int nutritionLength;

public:
void set(string , int);
void getMeals(string& , int&)const;
void print();
Nutrition(string , int);
double calories();
};
+++++++++++++++++++++++++++++++++++++++
class Regime
{
public:
void set(string,int ,string,int);
void print();
Regime(string ,int,string,int);
double calories();

private:
Gymnasium exercisePlan ;
Nutrition dietPlan;
};

/////The implitation of the set function of the class Regime how
should it be
///i did this
void Regime::set(string ex,int t,string f,int p)
{
Gymnasium::set(ex,t);
Nutrition::set(f,p);
}
//////but it gives me error
//// and if i want to subtract the calories in the Gymnasium from the
calories in the Nutrition ,like
double Regime::calories()
{
int After;


After=Gymnasium::calories()- Nutrition::calories();

return After;
}
////it gives me an error that it is illegal call of non-static member
function,why ? what should i do then ??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top