Own operator definition | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Own operator definition

Is it possible to define my operator? It should base on variable and type, and return bool. I would like to create my C++ version of instanceof.

9th Nov 2016, 4:58 PM
John Doe
1 Answer
+ 3
you can't define your own operator in C++. A work around is to use dynamic_cast as explained here http://stackoverflow.com/questions/351845/finding-the-type-of-an-object-in-c
7th Jan 2017, 12:06 PM
Caffeinated Gamer YT
Caffeinated Gamer YT - avatar