C++ Programming - Constructors and Destructors - Discussion

Discussion Forum : Constructors and Destructors - Programs (Q.No. 5)
5.
What will be the output of the following program?
#include<iostream.h> 
int val = 0; 
class IndiaBix
{
    public: 
    IndiaBix()
    {
        cout<< ++val;
    }
    ~IndiaBix()
    {
        cout<< val--; 
    } 
}; 
int main()
{
    IndiaBix objBix1, objBix2, objBix3;
    {
        IndiaBix objBix4;
    } 
    return 0;
}
1234
4321
12344321
12341234
43211234
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
12 comments Page 2 of 2.

Chandu reddy said:   6 years ago
Why the objBixx4 is declared in scope and Any special is there?

Roshni said:   6 years ago
Why the object objBix4 is declared within the brackets?


Post your comments here:

Your comments will be displayed after verification.