Daniel Oliveira Daniel Oliveira - 14 days ago 5
C++ Question

The Object java class equivalent C++

I know that in Java every class extends the Object class which in turn extends the class Class. But how does this work in C++? In there any class equivalent to the class Object or to the class Class in Java?

Thanks.

qxz qxz
Answer

There is no equivalent in C++ for either java.lang.Object or java.lang.Class. Different class hierarchies don't share a common root.

Also, Object does not extend Class. Object has no superclass; An Object is not a type of Class. However, Class does extend Object; an instance of Class, which represents a class, is itself an Object.

Comments