+ 1
Constructor and destructor
why not output of the code is cadb, instead of cabd? #include <iostream> using namespace std; 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
+ 5
Objects are destroyed in reverse order in which they were constructed.
+ 4
Post the link in the description of the Question instead of tagging and use the Tags section for tagging your programming language
0
Now ?