Which programming languages, other than C++, support operator overloading?

天大地大妈咪最大 提交于 2020-02-21 12:55:39

问题


I know C++.

Anything other?


回答1:


Wikipedia's article on Operator Overloading features a list of languages that support it.




回答2:


I'm amused thinking about it. Any C compiler for example, must tell between an int *c; and double d = (int) f * (float) g;. In the former case, * indicates c is a pointer to int while in the latter case it is a multiplication operator. Though not exported outside the compiler itself, C appears to have operator overloading feature. C++ exported it outside the compiler?

I am sure other languages like Java should have some mechanism to tell + or * or such operators when they are used between various combinations and permutations of the types of the operands.



来源:https://stackoverflow.com/questions/2865526/which-programming-languages-other-than-c-support-operator-overloading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!