adplus-dvertising
frame-decoration

Question

Which constructor will be called from the object created in the code below?
class A
{ 
 int i;
 A()
 { 
  i=0; cout<<i; 
 }
 A(int x=0)
 { 
  i=x;  cout<<I;  
 }
};
A obj1;

a.

Default constructor

b.

Parameterized constructor

c.

Compile time error

d.

Run time error

Answer: (c).Compile time error

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which constructor will be called from the object created in the code below?