What is a Virtual Destructor? Deleting a derived class object with a non-virtual destructor using a pointer of the base class type results in undefined behavior. While deleting instances of the derived class using a base class pointer object, a virtual destructor is used to free up the memory space allocated by the derived class […]
October 28, 2022 | C++ | No comments
What are Pure Virtual Functions? A pure virtual function is a virtual function in C++ that does not require any function definition and is only declared. It is declared by assigning a value of 0 to the declaration. For instance, What is an Abstract Class? In C++, an abstract class has at least one pure […]
October 27, 2022 | C++ | No comments
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