Easy learning with example program codes

CPP Object Class

CPP introduced the features of OOPs Concept, i.e, CPP is an object-oriented programming language which uses classes and objects for computations.

CPP Class:

A collection of Objects is termed as Class in OOPs concept. Every class has its own unique and distinguishable attributes and methods.


class ClassName:







CPP Object:

Anything that has state and behavior can be termed as an Object, be it physical or logical. An Object is an entity mentioned in OOPs concept and is frequently found in CPP codes.

Creating an object in CPP is similar as calling a function. The objects attributes can then be accessed by using the object name prefix.


#include <iostream.h>
using namespace std;
class Employees
string Name;  
float Salary;
void insert(string n, float s)    
Name = n;    
Salary = s;  
void details()
cout << "Employee Name : " << Name << endl;
cout << "Employee Salary: " << Salary << "\n\n";
int main()
Employees e1;   
Employees e2; 
e1.insert("Khush", 10000);    
e2.insert("Raam", 20000);    
return 0;


Employee Name : Khush                                 
Employee Salary: 10000                               
Employee Name : Raam                                                 
Employee Salary: 20000
Posted in CPP   

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki