+ 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 };

16th Jul 2016, 9:21 AM
Joyx Kish
Joyx Kish - avatar
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.
16th Jul 2016, 2:54 PM
kamal joshi
kamal joshi - avatar
+ 2
cabd because the constructor are in call of class priority same as destructor are work depends to the end of the constructor
16th Jul 2016, 6:11 PM
Ashok AK
Ashok AK - avatar
+ 1
cabd
16th Jul 2016, 9:56 AM
Dennis
Dennis - avatar