Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary Object-Oriented Programming – Core Concepts Simplified

Rating
-
Sold
-
Pages
39
Uploaded on
12-03-2026
Written in
2025/2026

Clear and concise notes explaining the core principles of object-oriented programming such as classes, objects, inheritance, polymorphism, encapsulation, and abstraction. Perfect for students who want a quick conceptual understanding and last-minute revision material.

Show more Read less
Institution
Course

Content preview

Object Oriented Programming
Classes and Objects:-
Class:-
A class is a user defined data that contained data as well as function together.
or
A class is a way to bind the data and function together in a single unit.
or
A class is a group of objects that share common properties and relationships
Note:-
1. The variables and functions enclosed in a class are called data member and member
functions.
2. The variable of class are called objects or instance of a class .
3. Classes are basic user defined data type of object oriented programming language
4. The difference between a class and structure is that ,by default ,all the members of a
class are private while by default ,all the members of structure are public

Class Declaration:-
Class <classname>
{
private:
data members;
member functions;
protected:
data members;
member functions;
public:
data members ;
member functions:
};
Note:- The data members and member functions of class are grouped under
three sections.
1. private
2. protected
3. public

Explanation of private ,protected & public access modifier:-
private :-
• By private we mean that members can be accessed only from within the class i.e member
data can be accessed by the member function .
• The private data members are not accessible to the outside worls (i.e outside the class)
• By default members of a class are private.
• Private members are not inheritable.

Protected:-
• The members which are declared as protected ,can only be accessed by member functions
and friends function function of that class.

1

, • Protected members are similer to private members ,the only difference is that protected
members are inheritable .
Public:-
The members which are declared as public can be accessed from out side classes also.
Note:- By default ,the members of a class are private .if both the lables ,are missing,then by
difault ,all the members are private .Such a class is completely hidden from outsite worls.
Example:-
class Student
{
int rollno;
float marks;
public:
void getdata(int x,flot y);
void display(void);
};
Array of Objects:- An array of variables that are of the type Class .such variables are
called array of objects.
Example.
class employee
{
char name[50];
int age;
public:
void getdata(void);
void showdata(void);
};
The employee is a user defined data type and can be used to create objects that relate to
different categories of employees.
employee manager[4];
employee engineer[15];
employee workers[200];

Creating Objects:-
1. An object is an instance of class .
2. In general a class is a user defined data type .while an object is an instance of class
3. Once a class has been declared ,we can create variables of that type by using class name.
4. An object occupies memory space.

Let Student be the name of class

Student S1, S2;
or
Class Student
{
--------------
----------------
} S1,S2;
2

,Accessing Class Members:- After creating the objects there is a need to access the class
members .This can be done using ( . ) operator .
Syntax:
Objectname . Datamember
Objectname.memberfunction
As:
S1.getdata(129,100)
s1.display()
s1.rollno=129 // illegal statement
Note:- A variable declared public can be accessed by the objects directly.

//Example for public data members

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
class date
{
public:
int day;
int month;
int year;
};

date d1;
d1.day=26;
d1.month=6;
d1.year=2012
cout<<“ Date is=“<<d1.day<<“/” <<d1.months<<“/” <<d1.year<<endl;
getch();
}
Example 2:-Write a program to make use of simple arithmetic operations such as
addition,subtraction,multiplication division using the concept class.
#include <iostream.h>
#include<conio.h>
class calculator
{
private :
int x;
int y;
public :
void getdata();
{
cout<<“ Enter the two numbers:” << endl;
cin>> x >> y;
}
void display()
3

, {
cout<<“x=“<<x<<endl;
cout<<“y=“<<y<<endl;
}
void sum()
{
cout<<“ addition of x & y =“<<x+y<<endl;
}
void diff()
{
cout << “ diff of x & y =“ <<x-y<<endl;
}
void mul()
{
cout<<“ mul of x & y =“<<x*y<<endl;
}
void div()
{
cout<< “ div of x & y=“<< x/y<<endl;
}
};
Void main()
{
clrscr();
calculator C1;
c1.getdata();
c1.display();
c1.sum();
c1.diff();
c1.mul();
c1.div();
getch();
}

Class method definition:- The data members of a class must be declared within the body of
the class ,whereas member functions of the class can be defined in following ways:
1. Out side the class definition
2. Inside the class definitation
Member function outside the class definition:-
1. declare function prototype within the body of a class and then define it outside the body of class.
2. By using scope resolution operator ( : : ) we bind the function to the class.
Syntax:-
Return type classname :: functionname(argument declaration)
{
function body
}



4

Written for

Institution
Secondary school
Course
School year
5

Document information

Uploaded on
March 12, 2026
Number of pages
39
Written in
2025/2026
Type
SUMMARY

Subjects

$10.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
prabuddhaavdhute

Get to know the seller

Seller avatar
prabuddhaavdhute
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 months
Number of followers
0
Documents
10
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions