Home » C++ Programming » Constructors and Destructors

What will be the output of the following program? #include int val = 0; class CuriousTab { public: CuriousTab() { cout<< ++val; } ~CuriousTab() { cout<< val--; } }; int main() { CuriousTab objCuriousTab1, objCuriousTab2, objCuriousTab3; { CuriousTab objCuriousTab4; } return 0; }

← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!