programplug Logo




C++ OOP Object Class


Class

Class describe properties and method of an object.In other world class is a description of an object.Class is a blueprint or a set of instruction to build a specific type of object.

Syntax
class class_name
{
   field or data member or method
   field or data member or method
   field or data member or method
}

Object

Object is self-contained component which consists of methods and properties.In C++ is an object, and almost everything has attributes and methods.

Syntax
class_name object_name;

C++ Class And Object Example-

#include 
class Employe
{  
   public:  
   int id;    
   string name;    
   void insert(int i, string n)    
	{    
	  id = i;    
	  name = n;    
	}    
    void display()    
	{    
	  cout<< id << "  " << name << endl;    
	}    
};  
void main() 
{  
	Employe e1;   
	Employe e2;  
	e1.insert(1, "Rahul");    
	e2.insert(2, "Mohit");    
	e1.display();    
	e2.display();   
}  

output:
1 Rahul
2 Mohit






Our Services

Developing Cheapest Websites
Offer Digital Marketing
Provide College Projects
Attractive Website Developing
Summer Training,Industrial Training
SCO,SMO

Contact Us

Dehradun Uttarakhand India
www.programplug.com
info@programplug.com
08534019974
Designed By : Mridul Gupta

Other Link

About Us

Contact Us

Disclaimer

Privacy Policy