D
Digital Puer
I made the following table to help me (re)learn inheritence basics.
Can someone check if it's correct? This table requires a courier-like
font.
Java C++
---- ---
subclass' methods can yes, default must use "virtual" in front
override base class' of base class' method
subclass' methods can use "final" method don't use "virtual"
NOT override base class'
an empty base class use "abstract" in use "= 0" to make a
method front of method pure virtual method
subclass calls Base super.foo() Base::foo()
class' foo() method
determining an object's use instanceof use RTTI dynamic_cast
subclass when given a
pointer/reference to
base class
"prototypes" of a class' create interface create class definition
methods file .h file
constructors inherited? no no
Can someone check if it's correct? This table requires a courier-like
font.
Java C++
---- ---
subclass' methods can yes, default must use "virtual" in front
override base class' of base class' method
subclass' methods can use "final" method don't use "virtual"
NOT override base class'
an empty base class use "abstract" in use "= 0" to make a
method front of method pure virtual method
subclass calls Base super.foo() Base::foo()
class' foo() method
determining an object's use instanceof use RTTI dynamic_cast
subclass when given a
pointer/reference to
base class
"prototypes" of a class' create interface create class definition
methods file .h file
constructors inherited? no no