Code:
#include <iostream>
using namespace std;
class base{
protected:
int a;
public:
base(){ cout<<"\nconstructing default base object";};
base(int x){ a=x; cout<<"\nconstructing base object"; };
};
class inherit:public base{
private:
int c;
public:
inherit(){ cout<<"\n constructing default inherited object"; }
inherit(int x,int y):base(x),c(y){ cout<<"\n constructing inherited object";
}
};
int main(void){
inherit obj(1,2);
}
the above code has a base class and a derieved class. when obj is created,a base object is first created,followed by the inherited object.does any one has idea how to refer to / or make use of that base object created ?
Thanx alot if anyone could guide.