What can I do if I want to solve these errors after compiling this code without defining new constructor for any class .The given constructor for each class must take only one integer calue as a parameter except A!'s default constructor.
By default the derived class constructors will call the default base class constructor. If you want it to call another constructor you need to explicitly specify by listing the constructor in the constructor initialization list.
1 2 3 4 5 6 7 8 9
class A2 : public A1
{
public:
A2(int x)
: A1(x)
{
cout<<"A2:: A2(int) called"<<endl;
}
};