[求助]关于抽象类和引用!
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 { cout<<k+3; }
class YY:public XX
{
public:
~YY() {cout<<"YY"; }
void f()const {cout<<k-3; XX::f();}
} ;
int main()
{XX &p=*new YY;
p.f();
delete &p;
return 0;
};
XX &p=*new YY;这一句是什么意思?
[此贴子已经被作者于2006-3-3 16:52:24编辑过]