运算符重载
运算符重载
运算符重载用于拓展运算符的作用对象至任意对象
一元运算符(!,)
-[负号]
1 | BIG operator - () |
二元运算符(-,*,/)
注意顺序
+
1 | BIG operator + (const BIG &b) |
赋值运算符
=
1 | void operator = (const BIG &b) |
输入/输出运算符
<<
1 | friend ostream &operator << ( ostream &out, const BIG &p ) |
>>
1 | friend istream &operator >> ( istream &in, BIG &p ) |
递增递减运算符
++A
1 | BIG operator ++ () |
A++
1 | BIG operator ++ ( int ) |
类型转换运算符
(类型)
1 | operator char( ) |