CBase *base = new CDerived();
CBase *base = new CDeviced;
对于自定义类型,调用的都是无参构造函数,没区别的。
只不过对于内建类型不太一样,加了扩号会做默认值初值化
比如(在VS 2010上验证):
int* p = new int;//p指向的int值是不确定的;int* q = new int();//q指向的int值为0。
本文转自:http://blog.youkuaiyun.com/prstaxy/article/details/8373016