Daily Dose C++: Virtual Functions
February 12, 2021•177 words
Source
Geeks For Geeks: Virtual Functions
Dose
Polymorphism achieved through runtime.
Bound through using a pointer to a class object.
Need to use the keyword virtual to enable usage of virtual function
Since the derived object is related to the base object, you can pass a pointer to derived thorugh the base object.
Regardless, the base object will know to use the derived object.
class baseObject {
public:
// Note: virtual keyword used here for function.
virtual void pri...
Read post