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

CPP program to illustrate pointer to a class

31/03/2017 Categories: Classes and Objects. No Comments on CPP program to illustrate pointer to a class

A C++ program 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 = x; this->y = y; } void display() { cout<<“x = “<<x<<endl; cout<<“y = “<<y<<endl; } }; int main() { A *ptr = […]

Read the rest of this entry »

CPP program to illustrate this pointer

31/03/2017 Categories: Classes and Objects. No Comments on CPP program to illustrate this pointer

A C++ program to illustrate this pointer. Program is as follows:

Output for the above program is as follows:

 

Read the rest of this entry »

CPP program for implementing friend function

31/03/2017 Categories: Classes and Objects. No Comments on CPP program for implementing friend function

A C++ program for implementing friend function. Program is as follows:

Output for the above program is as follows:

 

Read the rest of this entry »

CPP program for illustrating access specifiers

31/03/2017 Categories: Classes and Objects. No Comments on CPP program for illustrating access specifiers

A program for illustrating access specifiers public, private, protected. Program is as follows:

Output for the above program is as follows:

 

Read the rest of this entry »

Cpp program demonstrating a bank account

23/03/2017 Categories: Classes and Objects. No Comments on Cpp program demonstrating a bank account

A program to represent a bank account. Program is as follows:

Input and output for the above program are as follows:

 

Read the rest of this entry »

Cpp program to illustrate the use of constructor and destructors

23/03/2017 Categories: Classes and Objects. No Comments on Cpp program to illustrate the use of constructor and destructors

A C++ program to illustrate the use of constructor and destructors. Program is as follows:

Input and output for the above program are as follows:

 

Read the rest of this entry »

Cpp program for illustrating function overloading in adding the distance class objects

23/03/2017 Categories: Classes and Objects. No Comments on Cpp program for illustrating function overloading in adding the distance class objects

We create a distance class with the following: feet and inches as data members member function to input distance member function to output distance member function to add two distance objects Now we overload the add function for adding two distance objects. Program is as follows:

Input and output for the above program are […]

Read the rest of this entry »

Cpp program to create objects of distance class and add them

23/03/2017 Categories: Classes and Objects. No Comments on Cpp program to create objects of distance class and add them

We create a distance class with the following: feet and inches as data members member function to input distance member function to output distance member function to add two distance objects We create two objects of distance class and add them. Program is as follows:

Input and output for the above program are as […]

Read the rest of this entry »
Scroll Up