hello guys...i just done my assignment and here's the code
the output should be like this
using namespace std;
CelestialBody (double );
class Planet : public CelestialBody
Planet(double , double);
Class Earth : public Planet
unsigned long int population ;
Celestialbody :: Celestialbody (double) :
cout<<"CelestialBody is called"<<endl;
Planet :: Planet (double) : size(SIZE) , orbit_time(ORBIT_TIME)
cout << "Planet constructor is called"<<endl;
Earth :: Earth ()
: Planet (1,40000), population (3000000000)
cout <<" Earth constructor is called."<<endl;
cout <<"Population =" <<population <<endl;
cout<<"orbit time = "<<orbit_time<< endl;
cout<< "size =" <<size <<endl;
int main ()
all looks fine but
CelestialBody constructor is called
Planet constructor is called
Population constructor is called
Population = 5000000000
orbit time = 1
size = 40000
but i am stuck in the earth class and constructor section.
I think i was mistaken in the area of calling of the CelestialBody constructor to initialize the
data members of both the Planet and CelestialBody.
I didn't declared SIZE and ORBIT_TIME but it will not effect the end results will it?
any help plez..i did my homework..need for it to be compiled..