我从维基百科读过:
“References cannot be null,whereas pointers can; every reference refers to some object,although it may or may not be valid.”
class person { public: virtual void setage()=0; }; main() { person *object=NULL; person &object1=*object; }
请详细说明这一点.
解决方法
说个人&object1 = *对象与说person& object1 = NULL是不一样的.编译器可能不够聪明,无法发现您正在取消引用空指针,反而会出现运行时错误.所以他们是真实的;)