⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example1-20.cpp

📁 关于书籍《Borland c++Builder工程实践》的源代码
💻 CPP
字号:
#include <iostream.h>
class  TPoint
{
public:
TPoint(double m,double n)
{
x=m;
y=n;
}
virtual double Area() const
{
	return 0.0;
}
private:
double x,y;
};
class TRectangle:public TPoint
{
public:
TRectangle(double m,double n,double j,double k);
virtual double Area() const
{
return w*h;
}
private:
double w,h;
};
TRectangle:: TRectangle(double m,double n,double j,double k):TPoint(m,n)
{ 
	w=j;
	h=k;
}
void function1(TPoint &s)
{
cout<<"The area of  the  rectangle is :"<<s.Area()<<endl;
}
void main()
{
TRectangle rect(3.5,8.9,5.0,12.5);
function1(rect);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -