求助!关于抽象类和引用!
class XX{
protected:
int k;
public:
XX(int n=5):k(n){}
~XX() {cout<<"XX";}
virtual void f()const=0;
};
inline void XX::f()const { cont<<k+3; }
class YY:public XX
{
public:
~YY() {cont<<"YY"; }
void f()const {cont<<k-3; XX::f();}
} ;
int main()
{XX &p=*new YY;
p.f();
delete &p;
return 0;
};
XX &p=*new YY;这一句是什么意思?
[此贴子已经被作者于2006-2-27 18:46:26编辑过]