虚函数与运算符重载(Virtual Operator Overloading)
虚函数与运算符重载(Virtual Operator Overloading) 一、相关日志 运算符重载 http://blog.163.com/zhoumhan_0351/blog/static/399542272010027113311390 多态性与虚函数 http://blog.163.com/zhoumhan_0351/blog/static/3995422720100290234430 补充运算符重载 http://blog.163.com/zhoumhan_0351/blog/static/3995422720103182106992 二、虚函数与运算符重载 1、矩阵相乘的一个例子 //: C15:OperatorPolymorphism.cpp // Polymorphism with overloaded operators #include <iostream> using namespace std; class Matrix; class Scalar; class Vector; class Math { public: virtual Math& operator*(Math& rv) = 0; virtual Math& multiply(Matrix*) = 0; virtual Math& multiply(Scalar*) = 0;