写个c++小例子
class Rational{ public: const Rational operator*( const Rational& rhs); Rational(int num); private: int a; }; Rational::Rational(int num) :a(num) { } const Rational Rational::operator*(const Rational& rhs) { return Rational(this->a * rhs.a); } int main() { Rational a(2); Rational b(3); Rational c = a * b; return 0; }