I am using VC++.
I define a parent class:
class A
{
A();
A(int a);
virtual ~A();
virtual void DoSomething();
}
Then define a child class:
class B: public A
{
virtual void DoSomething();
}
In class B, only a new version of DoSomething is introduced. All other functions, including the constructors and destructor are same as A.
For example, both the following constructor are OK for B:
B MyB;
B MyB(1);
In such a case, need I create the constructors B() and B(int a)?
I try to obmit the constructors & destructor in B(), hoping it can inherit from A, but the compiler will report error for:
B MyB(1);