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.
Home ยป Page 31

Pure Virtual Function Program in C++

Suryateja Pericherla Categories: Inheritance. No Comments on Pure Virtual Function Program in C++

In this article we will learn how to implement a pure virtual function program in C++. A C++ program is provided to illustrate the concept of 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 […]

Read the rest of this entry »

CPP program to demonstrate runtime polymorphism

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

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 Dog : public […]

Read the rest of this entry »

CPP program to show how constructors are invoked in derived class

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

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: A(int p) { […]

Read the rest of this entry »

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

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

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 A { public: […]

Read the rest of this entry »

CPP program to implement virtual base class

Suryateja Pericherla Categories: Inheritance. No Comments on CPP program to implement virtual base class

In this article we will learn to implement a CPP program to implement virtual base class. A C++ program is provided below to illustrate virtual base class.   Program is as follows: #include <iostream> using namespace std; class A { protected: int x; }; class B : virtual public A { private: int y; public: […]

Read the rest of this entry »

CPP program to overload assignment operator

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

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 operator =(Number &n) […]

Read the rest of this entry »

CPP program to overload binary operator using non member function

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

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 i) { real […]

Read the rest of this entry »

CPP program to overload unary operator using member function

Suryateja Pericherla Categories: Polymorphism. No Comments on CPP program to overload unary operator using member function

In this article we will learn to implement a CPP program to overload unary operator using member function. A C++ program is overloaded to overload unary operator using member function.   Program is as follows: #include <iostream> using namespace std; class Number { private: int x; public: Number(int p) { x = p; } void […]

Read the rest of this entry »

CPP program to illustrate pointer to a class

Suryateja Pericherla Categories: Classes and Objects. No Comments on CPP program to illustrate pointer to a class

In this article we will learn to implement a CPP program to illustrate pointer to a class. A C++ program is given below to illustrate pointer to a class.   Program is as follows: #include <iostream> using namespace std; class A { private: int x; int y; public: A(int x, int y) { this->x = […]

Read the rest of this entry »

CPP program to illustrate this pointer

Suryateja Pericherla Categories: Classes and Objects. No Comments on CPP program to illustrate this pointer

In this article we will learn to implement a CPP program to illustrate this pointer. A C++ program is provided below to demonstrate this pointer.   Program is as follows: #include <iostream> using namespace std; class A { private: int x; int y; public: A(int x, int y) { this->x = x; this->y = y; […]

Read the rest of this entry »
Facebook
Twitter
Pinterest
Youtube
Instagram
Blogarama - Blog Directory