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

CPP program to illustrate runtime polymorphism

31/03/2017 Categories: Polymorphism. No Comments on CPP program to illustrate runtime polymorphism

A C++ program to illustrate runtime polymorphism. Program is as follows: #include <iostream> using namespace std; class Animal { public: virtual void sound() = 0; virtual void move() = 0; }; class Dog : public Animal { public: void sound() { cout<<“Bow wow wow”<<endl; } void move() { cout<<“Dog is moving”<<endl; } }; class Cat : […]

Read the rest of this entry »

CPP program to implement overloading of assignment operator

31/03/2017 Categories: Polymorphism. No Comments on CPP program to implement overloading of assignment operator

A C++ program to implement overloading of assignment operator. Program is as follows:

Output for the above program is as follows:

 

Read the rest of this entry »

CPP program to overload binary operator using non member function

31/03/2017 Categories: Polymorphism. No Comments on CPP program to overload binary operator using non member function

A C++ program to overload binary operator using non-member function. Program is as follows:

Output for the above program is as follows:

 

Read the rest of this entry »

CPP program to overload unary operator using member function

31/03/2017 Categories: Polymorphism. No Comments on CPP program to overload unary operator using member function

A C++ program to overload unary operator using member function. Program is as follows:

Output for the above program is as follows:

 

Read the rest of this entry »
Scroll Up