#include
The class test
{int x;
Public:
The test ()
{cout<" The constructor is called \ n "& lt; & lt; endl;
X=0; }
Voidshow ()
{coudt<" X="& lt; & lt; x<& lt; endl; }
};
Int main ()
{the test obj1 obj2;
Obj1. The show ();
Obj2. The show ();
return 0;
}
Ask: in I think the output should be
The constructor is called
X=0
The constructor is called
X=0
But problem sets written in the first two functions is called, x=0 for a piece, to solve the
CodePudding user response:
The test obj1 obj2;This time is called the two constructors,