My Blog
Articles related to programming, computer science, technology and research.

CPP program to illustrate pure virtual function

31/03/2017 Categories: Inheritance. No Comments on CPP program to illustrate pure virtual function

A C++ program to illustrate pure virtual function and calculate the area of different shapes by using abstract class. Program is as follows: #include <iostream> using namespace std; class Shape { public: virtual void area() = 0; }; class Rectangle : public Shape { private: int l; int b; public: Rectangle(int x, int y) { l […]

Read the rest of this entry »

CPP program to show how constructors are invoked in derived class

31/03/2017 Categories: Inheritance. No Comments on CPP program to show how constructors are invoked in derived class

A C++ program to show how constructors are invoked in derived class. Program is as follows:

Output for the above program is as follows:

 

Read the rest of this entry »

CPP program to illustrate the order of execution of constructors and destructors in inheritance

31/03/2017 Categories: Inheritance. No Comments on CPP program to illustrate the order of execution of constructors and destructors in inheritance

A C++ program to illustrate the order of execution of constructors and destructors in inheritance. Program is as follows:

Output for the above program is as follows:

 

Read the rest of this entry »

CPP program to illustrate virtual base class

31/03/2017 Categories: Inheritance. No Comments on CPP program to illustrate virtual base class

A C++ program to illustrate virtual base class. Program is as follows:

Output for the above program is as follows:

 

Read the rest of this entry »
Scroll Up