有人可以解释为什么以下工作,尝试以下代码,它工作正常.
class A {
public :
int32_t temp ;
A ( bool y = false ) { }
} ;
int main ( int argc, char *argv[] )
{
A temp ;
temp = new A () ;
temp.temp = 5 ;
std::cout << " " << temp.temp << std::endl ;
return EXIT_SUCCESS;
} // ---------- end of function main ----------
Run Code Online (Sandbox Code Playgroud)