Startertutorials Blog
Tutorials and articles related to programming, computer science, technology and others.
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.

CPP program to illustrate member function template

Categories: Templates. No Comments on CPP program to illustrate member function template

Post Views: 27 In this article we will learn to implement a CPP program to illustrate member function template. A C++ program is provided below to illustrate member function template.   Program is as follows: #include <iostream> using namespace std; class Adder { public: template<class T1, class T2> void add(T1 x, T2 y) { cout<<"Sum […]

Read the rest of this entry »

CPP program to illustrate class template with multiple parameters

Categories: Templates. No Comments on CPP program to illustrate class template with multiple parameters

Post Views: 18 In this article we will learn to implement a CPP program to illustrate class template with multiple parameters. A C++ program is provided below to demonstrate a template class with multiple parameters.   Program is as follows: #include <iostream> using namespace std; template<class T1, class T2> class Adder { private: T1 x; […]

Read the rest of this entry »

CPP program to demonstrate runtime polymorphism

Categories: Polymorphism. No Comments on CPP program to demonstrate runtime polymorphism

Post Views: 12 In this article we will look at how to implement a CPP program to demonstrate runtime polymorphism. A C++ program is provided below 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 […]

Read the rest of this entry »

CPP program to show how constructors are invoked in derived class

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

Post Views: 11 In this article we will try to implement a CPP program to show how constructors are invoked in derived class. A C++ program is given below to demostrate how constructors are invoked in derived class.   Program is as follows: #include <iostream> using namespace std; class A { protected: int x; public: […]

Read the rest of this entry »

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

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

Post Views: 22 In this article we will learn to implement a CPP program to illustrate the order of execution of constructors and destructors in inheritance. A C++ program is provided below to demonstrate in which order constructors and destructors are executed in inheritance.   Program is as follows: #include <iostream> using namespace std; class […]

Read the rest of this entry »

CPP program to overload assignment operator

Categories: Polymorphism. No Comments on CPP program to overload assignment operator

Post Views: 17 In this article we will learn to implement a CPP program to overload assignment operator. A C++ program is provided below to implement overloading of assignment operator.   Program is as follows: #include <iostream> using namespace std; class Number { private: int x; public: Number(int p) { x = p; } Number […]

Read the rest of this entry »

CPP program to overload binary operator using non member function

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

Post Views: 15 In this article we will learn to implement a CPP program to overload binary operator using non member function. A C++ program is provided below to overload binary operator.   Program is as follows: #include <iostream> using namespace std; class Complex { private: float real; float imag; public: Complex(){} Complex(float r, float […]

Read the rest of this entry »