C++ equivalent of java’s instanceof

Try using: This requires your compiler to have rtti support enabled. EDIT: I’ve had some good comments on this answer! Every time you need to use a dynamic_cast (or instanceof) you’d better ask yourself whether it’s a necessary thing. It’s generally a sign of poor design. Typical workarounds is putting the special behaviour for the … Read more