Professional Documents
Culture Documents
CONCEPTS OF
OF OBJECT
OBJECT
ORIENTED
ORIENTED PROGRAMMING
PROGRAMMING
BY:
Generations of Programming
Languages
First Second Third Fourth Fifth
Generation Generation Generation Generation Generation
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
• Single
• Multi-Level
• Hierarchical
• Multiple
• Multipath
Polymorphism
#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