C++的问题,希望大家帮帮忙

1。设计一个矩阵类,要求矩阵类中重载运算符加(+),减(—),乘(*),赋值(=)和加赋值(+=),主函数定义类对象并调用重载的运算符。
2,设计一个基类Shapes,包含成员display()声明为虚函数。Shapes类公有派生类产生了Rectangle类和Circle类,分别定义display()实现其主要几何元素的显示。使用抽象类Shapes类型的指针,当他指向某个派生类的对象时,就可以通过它访问该对象的虚成员函数display()。

class CMatrix
{
public:
CMatrix();
CMatrix(const CMatrix& other);

CMatrix& operator+(const CMatrix&);
CMatrix& operator-(const CMatrix&);
CMatrix& operator*(const CMatrix&);
CMatrix& operator=(const CMatrix&);
CMatrix& operator+=(const CMatrix&);
private:
int x;
int y;
int **m_ppArray;//用于保存矩阵的各元素
};
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-04-01
这也是我们的作业。。。。。
相似回答