#include using namespace std; class Figure{ protected: double x,y; public: void set(double i, double j){ x=i;y=j; } virtual void area()=0; }; class Trianle:public Figure{ public: void area(){ cout<<"三角形面积:"<area(); r.set(10,20); pF=&r; pF->area(); //定义抽象类引用 Figure &rF=t; rF.set(20,20); rF.area(); system("pause"); return 0; }