写个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();
Rational b();
Rational c = a * b;
return ;
}
上一篇:RSA密钥生成与使用


下一篇:Spring操作指南-AOP基本示例(基于XML)