#include<iostream.h>
class point
{
private:
float x,y;
public:
void setcon(float i,float j) {x=i;y=j;}
float area(){return 0.0;}
};
const double pi=3.14159;
class circle:public point{
private:
double radius;
public:
void setsize(double r){radius=r;}
double area(){return pi*radius*radius;}
};
void main()
{
point p;
double a=p.area();
cout<<"The area of the point p is"<<a<<endl;
circle c;
c.setsize(3.65637);
a=c.area();
cout<<"The area of the circle c is"<<a<<endl;
point *pp;//由于c++对重载函数使用静态联编,因此,在编译时,c++编译器假设pp指向
pp=&c;//point类的对象,因为这是pp的类型。因此根据指针的类型,c++编译器在编译时决定调用point类中
cout<<"The area of the pp->area() is"<<pp->area()<<endl;//定义的函数,因此静态联编时这种方法不能达到预期的结果
cout<<"/n";
}