Skip to content

Tag Archives: cpp-inheritance

Base Class: A base class is a class in Object-Oriented Programming language, from which other classes are derived. The class which inherits the base class… Read More
Object oriented design started right from the moment computers were invented. Programming was there, and programming approaches came into the picture. Programming is basically giving… Read More
1. What is a pure virtual function? Ans. A pure virtual function (or abstract function) in C++ is a virtual function for which we don’t… Read More
There are certain situation when we want to make some of the public base class functions as private in the derived class. Suppose both base… Read More
Binding refers to the process of converting identifiers (such as variable and performance names) into addresses. Binding is done for each variable and functions. For… Read More
Prerequisite: Virtual Function in C++ Calling virtual functions from a constructor or destructor is considered dangerous most of the times and must be avoided whenever… Read More
A virtual function is a member function which is declared within a base class and is re-defined(Overriden) by a derived class. When you refer to… Read More
Prerequisite: Constructors Whenever we create an object of a class, the default constructor of that class is invoked automatically to initialize the members of the class. If… Read More
TABLE OF CONTENT: Introduction Class Objects Encapsulation Abstraction Polymorphism Inheritance Dynamic Binding Message Passing Object-oriented programming – As the name suggests uses objects in programming.… Read More
Predict the output of the following simple C++ program without any virtual function. #include <iostream> using namespace std;    class Base { public:     void print()… Read More
Sometimes implementation of all function cannot be provided in a base class because we don’t know the implementation. Such a class is called abstract class.… Read More
  This article introduces the concept of polymorphism and virtual functions, and their use in inheritance. We’ll cover the following Definitions Without Virtual Functions Using… Read More
If we have a function in base class and a function with same name in derived class, can the base class function be called from… Read More
The purpose of inheritance is same in C++ and Java. Inheritance is used in both languages for reusing code and/or creating an ‘is-a’ relationship. The… Read More
Following are the things which a derived class inherits from its parent. 1) Every data member defined in the parent class (although such members may… Read More