题目
定义一个基类Shape,在此基础上派生出Rectangle和Circle,二者都有getArea()的成员函数计算对象的面积。使用Rectangle类创建一个派生类Square。
源代码
#include "stdafx.h"
#include<iostream>
using namespace std;
class shape {
public:
shape() {
};
~shape() {
};
virtual float getArea() {
return 0;}
};
class circle :public shape {
public:
circle(float r)<