class AES
{
public:
AES(){m_data=2;}
virtual void fun1(){cout<<"fun1"<<endl;}
void fun2(){cout<<"fun2"<<endl;}
void fun3(){cout<<m_data<<endl;}
private:
int m_data;
};
int main()
{
VA *p=NULL;
p->fun1(); //对象未构造,虚表未产生;编译通过,运行失败;
p->fun2();
p->fun3(); //对象未构造,成员变量未产生;编译通过,运行失败;
return 0;
}
时间: 2024-11-01 07:18:37