C++ 什么时候用 "new" ?# Programming - 葵花宝典
s*1
1 楼
如果我有一个 class MyClass, 有一个constructor MyClass(int x).
在main 里面:
1) MyClass myObj(12);
2) MyClass myObj = new MyClass(12);
有什么区别? 哪一个更好?
在main 里面:
1) MyClass myObj(12);
2) MyClass myObj = new MyClass(12);
有什么区别? 哪一个更好?