why there is no power operator in java / c ++?

Posted by RanZilber on Programmers See other posts from Programmers or by RanZilber
Published on 2011-03-03T08:52:46Z Indexed on 2013/10/29 10:18 UTC
Read the original article Hit count: 189

Filed under:
|
|

While there is such operator - ** in Python , i was wondering why java and c++ havent got one too.

It is easy to make one for classes you define in C++ with operator overloading ( and i believe such thing is possible also in java) , but when talking about primitive types such as int, double and so on , you'll have to use library function like Math.power (and usaully have to cast both to double).

So - why not define such operator for primitive types ?

© Programmers or respective owner

Related posts about java

Related posts about c++