0% found this document useful (0 votes)
40 views14 pages

Concepts of Object Oriented Programming

This document discusses concepts of object-oriented programming including classes, objects, data encapsulation, data abstraction, data hiding, inheritance, and polymorphism. It provides examples of each concept. Specifically, it defines a class called rectangle with width and length data members and getdata and putdata member functions. It then shows a C++ program that creates a rectangle object r1 and calls the getdata and putdata methods on r1 to get input and display output for the rectangle's width and length.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views14 pages

Concepts of Object Oriented Programming

This document discusses concepts of object-oriented programming including classes, objects, data encapsulation, data abstraction, data hiding, inheritance, and polymorphism. It provides examples of each concept. Specifically, it defines a class called rectangle with width and length data members and getdata and putdata member functions. It then shows a C++ program that creates a rectangle object r1 and calls the getdata and putdata methods on r1 to get input and display output for the rectangle's width and length.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 14

CONCEPTS

CONCEPTS OF
OF OBJECT
OBJECT
ORIENTED
ORIENTED PROGRAMMING
PROGRAMMING
BY:
Generations of Programming
Languages
First Second Third Fourth Fifth
Generation Generation Generation Generation Generation

Machine Assembly High Level Object Expert


Language Language Oriented Systems
Language Language

O’s & 1’s Mnemonics Basic, C++, Turbo


COBOL, C V.B., JAVA Prolog
Basic Object Oriented
Concepts
• Class
• Object
• Data Encapsulation
• Data Abstraction
• Data Hiding
• Inheritance
• Polymorphism
CLASS

• A Class is a basic user defined data


type or in simple words it’s a
collection of similar type of entities.
• Each Class contains two sections:
Data Members
Member Functions
OBJECT
• It is a basic run time entity or simply
an object is an instance of class.

Fruit

Mango Apple
Banana
Data Encapsulation
• Wrapping up of two or more things in
a single unit is called encapsulation.
• As Class in C++ wraps two sections
(Data + Method) which is called Data
Encapsulation.
Data Abstraction

• Representing only essential details &


hiding background details is known as
Abstraction.
Data Hiding

• By OOPS we prevent our


functionality from outside or we hide
what is going in background. This
phenomenon is called Data Hiding.
Inheritance

• It is Re-Using existing classes to make new


classes so that objects of one class can acquire
the properties of other classes.

• Single
• Multi-Level
• Hierarchical
• Multiple
• Multipath
Polymorphism

• In simple words, Polymorphism is


ONE THING : MULTIPLE FORMS

It is the ability to behave differently


in different circumstances.
Visibility Modes
• Data Members & Member Functions can be
declared in any one of the following visibility
Modes:
Private (Default – Accessible in own
class by public members only)
Public ( Accessible anywhere outside
the class)
Protected (used to serve the
purpose of both private & public.
C++ FIRST PROGRAM : A CLASS : PART 1

#include<iostream.h>
#include<conio.h> Data Members Declared
class rectangle
{
public:
int width;
int length;
void getdata(void)
{
cout<< "\n Enter the WIDTH:"; Member
cin >> width; Functions
cout<< "\n Enter the LENGTH:"; Declared &
cin>> length; Defined
}
void putdata(void)
{
cout<< "\n WIDTH="<< width;
cout<< "\n LENGTH="<<length;
}
};
C++ FIRST PROGRAM : A CLASS : PART 2

void main()
{
rectangle r1; Creation of
object r1
r1.getdata(); from class
r1.putdata(); rectangle
getch();
}

Call to
member
functions
getdata() &
putdata()
for object r1
THANK YOU

You might also like