I have a question about this code:
class A
{
public:
A(){cout<<"A no parameter ";}
A(string s){cout<<"A string parameter";}
A(A &a){cout<<"A object A parameter";}
};
class B:public A
{
public:
B(){cout<<"B no parameters";}
B(string s){cout<< "B strig parameter";}
B(int s){cout<<"B int parameter";}
};
int main() {
A a2("Test");
B b1(10);
B b2(b1);
return 0;
}
When I run this code, I get this result:
A string parameterA no parameter B int parameterA object A parameterProgram ended with exit code: 0"
I am actually not sure why the statement A no parameter
shows up, even though I did not assign the statement about it.
I am studying coding for now, so I am glad if you explain this.
A
's constructor.