Programming Lab: Object  Oriented Language (OOPs) AKU,PATNA


  1. Program to Understand class and object in C++
  2. Program to Understand constructor and destructor in C++
  3. Program to Understand Inheritance properties in C++
  4. Program to Understand Operator  Overloading Concept in C++
  5. Program to Understand Function  Overloading Concept in C++

Download in pdf Oops LAB click here

EXPERIMENT NO 1:  Program to Understand  class and object in C++.


Class:  A class in user defined data type decleared with keyword class that has data and function as its member whose access is governed by the three access specifier private protected and public to member of a class.

Syntax of class:  class name of class
{public/protected/private: data type declearation;
function name(){}
Example:     class area
{ private: int a,b;
public: get(){cout<<”Enter height and width”;

Object:  A class is a user defined data type ,which hold its own data member and                 member function,which can be accessed and used by creating instance of that class.
is called object of a class…
syntax:  class name object name; 

Ex:Write a program in c++ to Understand  class and object .

class student


char name[30],fname[30],cls[10];

    input()   //define input function


cout<<endl<<“Name of student :-“;

gets(name);// cin>>name;
cout<<“Enter Father’s Name:-“;

cin>>fname  ;

cout<<“Enter Class:-“;


}//end of input

show()    //define show function


cout<<endl<<“Name of student:- “;


cout<<“\nFather’s Name:- “;


}// end of show
};   //end of class

int main()


student   obj;       //creating the object of class

obj.input();    //call the input fun;     //call the show fun

return 0;

}//end of main


OUTPUT:  Name of student:- chand
Enter father’s name:-salahuddin
Enter class:btech


Name of student:- chand
Father’s name:-salahuddin

Tagged .

Leave a Reply

Your email address will not be published. Required fields are marked *