Class 12 Computer Science Study Guide: Class 12 OOP Classes And Objects Revision Notes
Access comprehensive study materials and useful resources for OOP Classes And Objects using the Class 12 OOP Classes And Objects Revision Notes. Designed to align with the 2026-27 CBSE academic guidelines, these advanced resources help Class 12 Computer Science students reinforce core concepts beyond standard textbooks.
Download OOP Classes And Objects Study Material PDF
View or download the dedicated Class 12 OOP Classes And Objects Revision Notes resource below. Engaging with these advanced study guides under focused conditions ensures continuous academic progress and mastery of the 2026-27 curriculum for OOP Classes And Objects.
Unit I – Object Oriented Programming in C++
Chapter 2: OOP, Classes and Objects (Revision Notes)
Class: A class is a collection of data (data members) and the functions (member functions or methods) that work on the data. It can be seen as a blueprint for the object. No memory is allocated when a class is created. Memory is allocated only when an object is created.
Object: An object is an instance of a class.
Data member: The data declared within the class.
Member functions: Member functions are the methods which are declared or defined inside the class and operate upon the data members.
Data abstraction: Data abstraction represents the essential features without including the background details.
Data encapsulation: It binds the data and its functions into a single unit called a class.
Data hiding: It hides the internal details of an object (the data members). Data hiding ensures exclusive data access to the class members and protects the integrity of the object by preventing unintended or intended changes.
Inheritance: Inheritance is the process of forming a new class from an existing class or base class.
Base class: The class from which methods and data members are derived by the new class. The base class is also known as the parent class or super class.
Derived class: The class that derives data and methods from the base class. It is also known as a child class or sub class.
Polymorphism: Poly means many and morph means form (multiple forms). It refers to the ability to process data in more than one form.
Access specifiers: private, protected and public. The default access specifier is private.
Accessibility of private, protected and public members
| Accessibility | Private | Protected | Public |
|---|---|---|---|
| Through member functions | Yes | Yes | Yes |
| Through an object of the class | No | No | Yes |
| Through a derived class | No | Yes | Yes |
Syntax of a class
class <class_name>
{
private:
declaration of data members;
declaration/definition of member functions;
protected:
declaration of data members;
declaration/definition of member functions;
public:
declaration of data members;
declaration/definition of member functions;
};Example
class student
{
private:
char name[30];
int age;
int marks;
protected:
char grade;
public:
void getdata();
void showdata();
};Referencing class members: All the data members of a class are directly accessible to the member functions of that class. They do not need an object name prefixed to them. From outside the class, any reference to a data member is made with the dot (.) operator.
Syntax for creating an object:
<class_name> <object_name>;Example:
student s1;Accessing members from an object of the class: A data member or member function declared under the public access specifier can be accessed directly by the objects.
objectname.member;For example:
s1.getdata();
s1.showdata();Defining class methods (member functions): The member functions of a class can be defined in two ways.
- Inside the class definition (inline function): The function is defined within the class body and is treated as inline by default.
- Outside the class definition: The function prototype is declared within the class body, and the function is defined outside the class with the help of the scope resolution operator (::).
Syntax for defining a member function outside the class definition:
<return type> <class name> :: <function name>(parameter list)
{
body of the function
}Example for defining a member function outside the class definition:
void student::showdata()
{
cout<<"\n Name "<<name;
cout<<"\n Age "<<age;
cout<<"\n Marks "<<marks;
}Example: defining member functions within the class body
class STUDENT
{
int rollno;
char name[20];
char address[30];
char phoneno[15];
public:
void enter()
{
cout<<"\n Enter roll no, name, address and phone no. ";
cin>>rollno;
cin.getline(name,20);
cin.getline(address,30);
cin.getline(phoneno,15);
}
void display()
{
cout<<"information of student is";
cout<<rollno<<name<<address<<phoneno;
}
};Example: defining member functions outside the class body
class STUDENT
{
int rollno;
char name[20];
char address[30];
char phoneno[15];
public:
void enter();
void display();
};
void STUDENT :: enter()
{
cin>>rollno;
cin.getline(name,20);
cin.getline(address,30);
cin.getline(phoneno,15);
}
void STUDENT :: display()
{
cout<<"information of student is";
cout<<rollno<<name<<address<<phoneno;
}Short answer type questions (2 marks)
What do you understand by class and object in C++?
Answer: A class is a user-defined data type. It is a blueprint that groups data members and the member functions that work on them. An object is an instance of a class. Memory is allocated only when an object is created.
Which members of a class are accessible outside the class body?
Answer: Only the public members, which are accessed through an object with the dot operator. The private and protected members cannot be accessed from outside the class.
What do you understand by data abstraction?
Answer: Data abstraction means showing only the essential features to the user and hiding the background details of how they work. For example, a user calls a function without knowing its internal code.
What do you understand by data hiding?
Answer: Data hiding means keeping the data members of a class private, so they cannot be reached directly from outside the class. They can be accessed only through the member functions. This protects the data from unintended or intended changes.
What do you understand by encapsulation?
Answer: Encapsulation means binding the data and the functions that work on the data together into a single unit called a class.
What is polymorphism?
Answer: Polymorphism means "many forms". It is the ability of a function or an operator to work in more than one form, for example function overloading and operator overloading.
What do you understand by a member function? How does a member function differ from an ordinary function?
Answer: A member function is a function that is declared or defined inside a class and works on the data members of that class. An ordinary function is defined outside any class. A member function can directly use the private and protected data members of its class, and it is called with an object using the dot operator (for example s1.getdata();). An ordinary function cannot access private members directly and is called without an object.
How does a class implement data abstraction and encapsulation?
Answer: A class binds the data members and the member functions together in one unit, which is encapsulation. It keeps the data members private or protected and gives the outside world only the public member functions to use them, without showing how the work is done inside. This hides the details and shows only the essential interface, which is data abstraction.
Long answer type questions (4 marks)
Define a class train with the following members.
Private members: Trainno (type int), Destination (type string), Distance (type float), Fuel (type float). A member function calfuel() calculates and assigns the value of Fuel as per the following criteria:
| Distance | Fuel |
|---|---|
| <= 1500 | 250 |
| > 1500 and <= 3000 | 1000 |
| > 3000 | 2500 |
Public members:
feedinfo(): to input the train number, destination and distance, and to invoke thecalfuel()function to assign the value of fuel.showinfo(): to display all the details of a train.
Answer:
#include<iostream.h>
class train
{
int Trainno;
char Destination[20];
float Distance;
float Fuel;
void calfuel()
{
if(Distance<=1500)
Fuel=250;
else if(Distance<=3000)
Fuel=1000;
else
Fuel=2500;
}
public:
void feedinfo()
{
cout<<"Enter train number, destination and distance: ";
cin>>Trainno>>Destination>>Distance;
calfuel();
}
void showinfo()
{
cout<<"Train number : "<<Trainno<<endl;
cout<<"Destination : "<<Destination<<endl;
cout<<"Distance : "<<Distance<<endl;
cout<<"Fuel : "<<Fuel<<endl;
}
};Define a class employee with the following specifications.
Private members: empno (integer type), ename (string of 20 characters), basic, hra, da (float type), netpay (float type). ctotal() is a function to calculate the total basic.
Public members: read_data() is a function to read empno, ename, basic, hra and da, and to call ctotal() to calculate the total. display_data() is a function to display all the data members on the screen.
Answer:
#include<iostream.h>
class employee
{
int empno;
char ename[20];
float basic,hra,da;
float netpay;
void ctotal()
{
netpay=basic+hra+da;
}
public:
void read_data()
{
cout<<"Enter empno, name, basic, hra and da: ";
cin>>empno>>ename>>basic>>hra>>da;
ctotal();
}
void display_data()
{
cout<<"Employee number : "<<empno<<endl;
cout<<"Name : "<<ename<<endl;
cout<<"Basic : "<<basic<<endl;
cout<<"HRA : "<<hra<<endl;
cout<<"DA : "<<da<<endl;
cout<<"Net pay : "<<netpay<<endl;
}
};Free study material for Computer Science
CBSE Class 12 Computer Science Study Material: OOP Classes And Objects
Comprehensive Study Resources for OOP Classes And Objects
Review targeted study resources for OOP Classes And Objects tailored for Class 12 learners. Utilizing these structured notes and quick-revision tools ensures complete alignment with current CBSE evaluation standards.
Understanding Marking Schemes
Each resource draws directly from authorized textbooks to maintain academic accuracy. Evaluating solved examples allows Class 12 students to master the formal presentation and answer-writing standards expected in upcoming school exams.
Complete Revision for Computer Science
For peak performance in upcoming evaluations, integrate official Computer Science sample papers directly into your study schedule. Follow up your revision by attempting online MCQ tests for OOP Classes And Objects to refine calculation speed and precision.
FAQs
Our advanced study package for OOP Classes And Objects includes detailed concepts, diagrams, Mind Maps, and explanation of complex topics to ensure Class 12 students learn as per syllabus for 2026 exams.
The Mind Maps provided for OOP Classes And Objects act as visual anchors which will help faster recall during high-pressure exams.
Yes, teachers use our Class 12 Computer Science resources for lesson planning as they are in simple language and have lot of solved examples.
Yes, You can download the complete, mobile-friendly PDF of the Computer Science OOP Classes And Objects advanced resources for free.
Yes, our subject matter experts have updated the OOP Classes And Objects material to align with the rationalized NCERT textbooks and have removed deleted topics and added new competency-based questions.