Constructors and Destructors

Q1: What will be the output of the following program?
#include<iostream.h> 
int val = 0; 
class AptitudeCrack
{
    public: 
    AptitudeCrack()
    {
        cout<< ++val;
    }
    ~AptitudeCrack()
    {
        cout<< val--; 
    } 
}; 
int main()
{
    AptitudeCrack objAptitude1, objAptitude2, objAptitude3;
    {
        AptitudeCrack objAptitude4;
    } 
    return 0;
}

A 1234

B 4321

C 12344321

D 12341234

E 43211234

ANS:C - 12344321

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.