Consider this snippet of code.
class A{
public:
A(): a(10) {}
int a ;
};
class B{
public:
B() : A::A(){}
A a;
};
Compiler gave me a warning
error: type 'A' is not a direct base of 'B'|
I understand the error but how i can call A's constructor in B's constructor. Any alternative.
Ik it's an implicit call but i need an explicit call. As compiler says.
warning: 'B::a' should be initialized in the member initialization list [-Weffc++]|
P.S. - Don't recommend INHERITANCE. I can't do that.