是否可以用c ++编写自己的运算符 [英] Is it possible to write your own operators in c++
本文介绍了是否可以用c ++编写自己的运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以用c ++和ANDORNOT编写自己的运算符。
Is it possible to write your own operators in c++ like and "AND" "OR" "NOT".
推荐答案
你可以提供AND,OR和不是您自己班级的操作员: http://msdn.microsoft.com/ en-us / library / 5tk49fh2(v = VS.80).aspx [ ^ ]但您无法定义新的运算符。你不能扩展语言,这是需要的。 (好吧,你 可以 小心使用#DEFINE,但结果不会直观明显,可能会导致以后的维护问题)
You can provide AND, OR, and NOT operators for your own class: http://msdn.microsoft.com/en-us/library/5tk49fh2(v=VS.80).aspx[^] but you can''t define new operators. You can''t extend the language, which is what that would require. (Well, you could with careful use of #DEFINE but the result would not be intuitively obvious and might cause maintenance headaches later)
这篇关于是否可以用c ++编写自己的运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文