#include <iostream>
using namespace std;
class a
{
int b;
protected:
a()
{
cout<<"in a constructor";
}
};
class b:public a
{
int p;
};
int main()
{
b r;
return 0;
}
i just want to ask that why a::a() constructor is in protected mode then why is invoke?
If you calling virtual function, then object is already constructed, unless you are calling virtual function from the constructor. Which is might not work as you expect.