class TV
{
public:
int type;
void changeVol()
{
cout << "vol changed" <<endl;
}
};
从栈中实例化对象调用
TV tv;
Tv.type = 0;
Tv.changeVol();
从堆中实例化对象调用
TV *p = new TV();
if(NULL == p)
{
return 0;
}
p->type = 0;
p->changeVol();
delete p;
p = NULL;