0
How to write constructor for class B if it is a derived class of A? How to instantiate?
class A has an integer member, class B has a char member.
2 Antworten
0
the same as you would for a normal class,the base classes constructor just gets called first.
0
class B : public A
{
public:
A(int a) : member1(a) {};
B(char b) : member2(b) {};
};
*in main:*
B *obj = new B(14, 's');
Is this ok?