Which of the following statement is correct about the program given below? #include<iostream.h>
#include<process.h>
class CuriousTab
{
static int x;
public:
CuriousTab()
{
if(x == 1)
exit(0);
else
x++;
}
void Display()
{
cout<< x << " ";
}
};
int CuriousTab::x = 0;
int main()
{
CuriousTab objCuriousTab1;
objCuriousTab1.Display();
CuriousTab objCuriousTab2;
objCuriousTab2.Display();
return 0;
}
Correct Answer: The program will print the output 1.
Discussion & Comments