C ++ Typedef和运算符重载 [英] C++ Typedefs and operator overloading
本文介绍了C ++ Typedef和运算符重载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果定义类似typedef int MY_INT;
的类型并继续重载,例如,MY_INT的加法运算符类似
If you define a type like typedef int MY_INT;
and go on to overload, say, the adition operator of MY_INT like
MY_INT operator+(MY_INT a, MY_INT b);
将
MY_INT a, b;
a + b;
不同于
int A, B;
A + B;
?
很抱歉出现任何语法错误.我不在编译器附近,我想在忘记它之前先问这个问题.
Sorry for any syntax errors. I'm not near a compiler and I want to ask this before I forget about it.
推荐答案
否. typedef实际上是另一种类型的别名.原始类型和类型定义的类型相同.
No. A typedef is actually an alias for another type. The original and typedef-ed types are the same.
这篇关于C ++ Typedef和运算符重载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文