一元运算符重载 [英] Unary operator overloading

查看:79
本文介绍了一元运算符重载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是正确的吗?
通过友元函数重载的一元运算符带有一个引用参数.

谢谢!

Is this correct?
Unary operator overloaded by means of a friend function takes one reference argument.

Thanks!

推荐答案

不完全是.看一下教程:
重载一元运算符+,-和! [使用成员函数重载运算符 [重载递增和递减运算符 [ ^ ]
not exactly. take a look at the tutorial:
Overloading unary operators +, -, and ![^]
Overloading operators using member functions[^]
Overloading the increment and decrement operators[^]


这篇关于一元运算符重载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆