A virtual function is a member function declared in a base class that is re-defined (overridden) by a derived class. When you use a pointer or a reference to the base class to refer to a derived class object, you can call a virtual function for that object and execute the derived class’s version of […]
October 26, 2022 | C++ | No comments
Upcasting is the process of creating the derived class’s pointer or reference from the base class’s pointer or reference. It refers to the process of converting a derived class’s reference or pointer to a base class’s reference or pointer. Upcasting is a safer casting technique than downcasting. It supports public inheritance, which allows references to […]
October 26, 2022 | C++ | No comments
Inheritance refers to a class’s ability to derive properties and characteristics from another class. One of the most important aspects of Object-Oriented Programming is inheritance. This also allows: Code reusability Quick implementation time Runtime polymorphism In inheritance, there are two kinds of classes: A parent class, also known as a base class, is a class whose […]
October 21, 2022 | C++ | No comments