adplus-dvertising
frame-decoration

Question

What will be the output of the following program?
class Test
{
 public: Test() 
 { 
  cout  << "Test's Constructor is Called " << endl;  
 }
};
 
class Result
{
 static Test a;
 public:
 Result() 
 { 
  cout  << "Result's Constructor is Called " << endl; 
 }
}; 
 
void main() 
{ 
 Result b; 
}

a.

Test’s Constructor is Called

b.

Result’s Constructor is Called

c.

Result’s Constructor Called Test’s Constructor is Called

d.

Test’s Constructor Called Result’s Constructor is Called

Answer: (b).Result’s Constructor is Called

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the following program?