+ 1
can someone help solve this:what is the output of this; class A { public: A () { cout << "a";} ~A () { cout << "b" ;} }; class B public: B () { cout << "c" ;} ~B () {cout << "d" } }; int main () { B b A a };
3 Respostas
+ 3
cabd
first constructor of class B gets invoked followed by constructor of class A.
then, in the opposite direction destructor of class A gets invoked first followed by that of B.
+ 2
cabd because the constructor are in call of class priority same as destructor are work depends to the end of the constructor
+ 1
cabd