How to overload ^ operator tofind the square of given number in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to overload ^ operator tofind the square of given number in c++

C++ operator overloading

5th Apr 2018, 6:31 PM
Suriya Narayanan.N
Suriya Narayanan.N - avatar
2 Answers
+ 2
Tnq for your support let me try this out.
6th Apr 2018, 3:09 PM
Suriya Narayanan.N
Suriya Narayanan.N - avatar
+ 1
Hi Suriya Narayanan.N !Well first you will have to create a class, because if you try to overload the ^ operator to use only on built-in types (like int), it won't work. Have you tried overloading operators for your own classes before?
6th Apr 2018, 3:51 AM
Zeke Williams
Zeke Williams - avatar