SlideShare a Scribd company logo
1 of 10
Download to read offline
The four pillars of object oriented programming development :
1. Encapsulation :
Encapsulation is one of the fundamental concept of OOP's. It refers
to the bundling (combining) of data with the methods (member functions that
operate on that data) into a single entity (like wrapping of data and methods
into a capsule) called an Object. It is used to hide the values or state of a
structured data object inside a class, preventing unauthorized parties, direct
access with them. Publicly accessible methods are generally provided in the
class to access the values, and other client classes call these methods to retrive
and modify the values within the object.
We generally call the functions that are declared in c++ are called
as Member functions. But in some Object Oriented languages (OO's) we call
them as Methods. Also the data members are called Attributes or Instance
variables.
Take a look with an example :
#include<iostream>
using namespace std;
class s
{
public:
For references : http://comsciguide.blogspot.com/
int count; // data member of the class
s() // constructor
{
count=0; // data member initialization
}
int disp() // method of the same class
{
return count;
}
void addcount(int a) //method of the same class
{
count=count+a;
}
};
int main()
{
s obj;
obj.addcount(1);
obj.addcount(4);
obj.addcount(9);
cout<<obj.count; // output : 14
return 0;
}
In the above example u can observe that all tha data members and
methods are binded into a object called “obj”. In Encapsulation we can declare
data members as private, protected, or public. So we can directly access the
For references : http://comsciguide.blogspot.com/
data members (here count).
Features and Advantages of concept of Encapsulation :
• Makes maintenance of program easier .
• Improves the understandability of the program.
• As the data members and functions are bundled inside the class, human
errors are reduced.
• Encapsulation is alone a powerful feature that leads to information
hiding, abstract data type and friend functions.
WWW.COMSCIGUIDE.BLOGSPOT.COM
2.Data Hiding :
The concept of encapsulation shows that a non -member function
cannot access an object's private or protected data. This has leads to the new
concept of data hiding. Data Hiding is a technique specifically used in object
oriented programming(OOP) to hide the internal object details (data members
or methods) from being accessible to outside users and unauthorised parties.
The Private access modifier was introduced to provide that protection. Thus it
keeps safe both the data and methods from outside interference and misuse. In
data hiding, the data members must be private. The programmer must
For references : http://comsciguide.blogspot.com/
explicitly define a get or set method to allow another object to read or modify
these values.
For example :
class s
{
int count; // data member of the class
// default members are private
public:
s() // constructor
{
count=0; // data member initialization
}
int disp() // method of the same class
{
return count;
}
void addcount(int a) //method of the same class
{
count=count+a;
}
};
int main()
{
s obj;
obj.addcount(1);
obj.addcount(4);
obj.addcount(9);
cout<<obj.disp();
For references : http://comsciguide.blogspot.com/
return 0;
}
Here the data member count is private. So u can't access it directly.
Instead u can access it, by the methods of the same class. Here It is accessed by
the disp method .
• In some cases of two classes, the programmer might require an unrelated
function to operate on an object of two classes. The programmer then
able to utilize the concept of friend functions.
• It enhances the security and less data complexity
• The focus of data encapsulation is on the data inside the capsule while
that data hiding is concerned with restrictions and allowance in terms of
access and use.
WWW.COMSCIGUIDE.BLOGSPOT.COM
3.Inheritance:
Reusability is yet another important feature of OOP's concept. It is
always nice, if we could reuse something instead of creating the same all over
again. For instance, the reuse of a class that has already tested and used many
times can save the effort of developing and testing it again.
For references : http://comsciguide.blogspot.com/
C++ supports the concept of reusability. Once a class has written
and tested, it can be adapted by other programmers to suit their requirements.
This is done by creating new classes, and reusing the existing properties. The
mechanism of deriving a new class from old one is called Inheritance. The old
class is referred as “Base class”. And the new one created is called as
“Derived class”.
For references : http://comsciguide.blogspot.com/
FEATURE A
FEATURE C
FEATURE B
FEATURE A
FEATURE C
FEATURE B
FEATURE D
DERIVED FROM BASE CLASSDERIVED FROM BASE CLASS
BASE CLASSBASE CLASS
DERIVED CLASSDERIVED CLASS
Here is an example :
#include<iostream>
using namespace std;
class e
{
public:
int a;
void b()
{
a=10;
}
};
class c : public e // public inheritance
{
public:
void d()
{
cout<<a<<endl;
}
};
int main()
{
c ab;
ab.b();
ab.d();
}
For references : http://comsciguide.blogspot.com/
Here a is declared in the base class e and is inherited in
the class c so that we need not to it declare again.
• Reusing existing code saves time and increases a program's reliability.
• An important result of reusability is the ease of distributing class
libraries. A programmer can use a class created by another person or
company, and without modifying it, derive other classes from it that are
suited to their requirements.
WWW.COMSCIGUIDE.BLOGSPOT.COM
4.POLYMORPHISM:
Polymorphism -- “one interface, multiple methods.”
Polymorphism occurs when there is a hierarchy of classes and they
are related by inheritance. Generally, from the Greek meaning Polymorphism
is the ability to appear in many forms (having multiple forms) and to redefine
methods for derived classes.
A real-world example of polymorphism is a thermostat. No matter
what type of furnace your house has(gas, oil, electric, etc), the thermostat
works in the same way. In this case, the thermostat (which is the interface) is
the same, no matter what type of furnace (method) you have. For example, if
For references : http://comsciguide.blogspot.com/
you want a 70-degree temperature, you set the thermostat to 70 degrees. It
doesn't matter what t ype of furnace actually provides the heat.
This same principle can also apply to programming. For example,
you might have a program that defines three different types of stacks. One stack
is used for integer values, one for character values, and one for floating-point
values. You can define one set of names, push( ) and pop( ) that can be used for
all three stacks. In your program, you will create three specific versions of
these functions, one for each type of stack, but names of the functions should be
same. The compiler will automatically select the right function based upon the
data being stored. Thus, the interface to a stack -- the functions push( ) and
pop( ), are the same no matter which type of stack is being used. The individual
versions of these functions define the specific implementations (methods) for
each type of data.
• Polymorphism reduces complexity by allowing the same interface to be
used to access class of actions. It is the compiler's job to select the
specific action (method) to each situation.
Also see :
1.Programs those work in C but not in C++
2.Difference between malloc(),calloc(),realloc()
3.Dynamic memory allocation (Stack vs Heap)
4.3 ways to solve recurrence relations
For references : http://comsciguide.blogspot.com/
WWW.COMSCIGUIDE.BLOGSPOT.COM
For references : http://comsciguide.blogspot.com/

More Related Content

What's hot

oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaCPD INDIA
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented ProgrammingIqra khalil
 
Inheritance in JAVA PPT
Inheritance  in JAVA PPTInheritance  in JAVA PPT
Inheritance in JAVA PPTPooja Jaiswal
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS ConceptBoopathi K
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)MD Sulaiman
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops conceptsNilesh Dalvi
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT03062679929
 
Inheritance in Object Oriented Programming
Inheritance in Object Oriented ProgrammingInheritance in Object Oriented Programming
Inheritance in Object Oriented ProgrammingAshita Agrawal
 
Polymorphism presentation in java
Polymorphism presentation in javaPolymorphism presentation in java
Polymorphism presentation in javaAhsan Raja
 
sSCOPE RESOLUTION OPERATOR.pptx
sSCOPE RESOLUTION OPERATOR.pptxsSCOPE RESOLUTION OPERATOR.pptx
sSCOPE RESOLUTION OPERATOR.pptxNidhi Mehra
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programmingAmar Jukuntla
 
Object oriented programming c++
Object oriented programming c++Object oriented programming c++
Object oriented programming c++Ankur Pandey
 
Polymorphism In c++
Polymorphism In c++Polymorphism In c++
Polymorphism In c++Vishesh Jha
 
Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4MOHIT TOMAR
 

What's hot (20)

oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in java
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
Inheritance in JAVA PPT
Inheritance  in JAVA PPTInheritance  in JAVA PPT
Inheritance in JAVA PPT
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
 
Java(Polymorphism)
Java(Polymorphism)Java(Polymorphism)
Java(Polymorphism)
 
Inheritance in Object Oriented Programming
Inheritance in Object Oriented ProgrammingInheritance in Object Oriented Programming
Inheritance in Object Oriented Programming
 
Polymorphism presentation in java
Polymorphism presentation in javaPolymorphism presentation in java
Polymorphism presentation in java
 
sSCOPE RESOLUTION OPERATOR.pptx
sSCOPE RESOLUTION OPERATOR.pptxsSCOPE RESOLUTION OPERATOR.pptx
sSCOPE RESOLUTION OPERATOR.pptx
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programming
 
Abstract class
Abstract classAbstract class
Abstract class
 
Object oriented programming c++
Object oriented programming c++Object oriented programming c++
Object oriented programming c++
 
Polymorphism In c++
Polymorphism In c++Polymorphism In c++
Polymorphism In c++
 
Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4
 
Inheritance in OOPS
Inheritance in OOPSInheritance in OOPS
Inheritance in OOPS
 
Oop Presentation
Oop PresentationOop Presentation
Oop Presentation
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
 

Viewers also liked

Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Conceptsthinkphp
 
Object oriented programming (oop) cs304 power point slides lecture 01
Object oriented programming (oop)   cs304 power point slides lecture 01Object oriented programming (oop)   cs304 power point slides lecture 01
Object oriented programming (oop) cs304 power point slides lecture 01Adil Kakakhel
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented ProgrammingHaris Bin Zahid
 
Object-Oriented Programming Concepts
Object-Oriented Programming ConceptsObject-Oriented Programming Concepts
Object-Oriented Programming ConceptsKwangshin Oh
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programmingSachin Sharma
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental PrinciplesIntro C# Book
 
Knut Morris Pratt Algorithm
Knut Morris Pratt AlgorithmKnut Morris Pratt Algorithm
Knut Morris Pratt Algorithmthinkphp
 
Oop’s Concept and its Real Life Applications
Oop’s Concept and its Real Life ApplicationsOop’s Concept and its Real Life Applications
Oop’s Concept and its Real Life ApplicationsShar_1
 
Constructor and encapsulation in php
Constructor and encapsulation in phpConstructor and encapsulation in php
Constructor and encapsulation in phpSHIVANI SONI
 
SSRP Self Learning Guide Maths Class 10 - In Hindi
SSRP Self Learning Guide Maths Class 10 - In HindiSSRP Self Learning Guide Maths Class 10 - In Hindi
SSRP Self Learning Guide Maths Class 10 - In Hindikusumafoundation
 
Introduction - Imperative and Object-Oriented Languages
Introduction - Imperative and Object-Oriented LanguagesIntroduction - Imperative and Object-Oriented Languages
Introduction - Imperative and Object-Oriented LanguagesGuido Wachsmuth
 
Introduction to object oriented language
Introduction to object oriented languageIntroduction to object oriented language
Introduction to object oriented languagefarhan amjad
 

Viewers also liked (20)

Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
Object oriented programming (oop) cs304 power point slides lecture 01
Object oriented programming (oop)   cs304 power point slides lecture 01Object oriented programming (oop)   cs304 power point slides lecture 01
Object oriented programming (oop) cs304 power point slides lecture 01
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Object-Oriented Programming Concepts
Object-Oriented Programming ConceptsObject-Oriented Programming Concepts
Object-Oriented Programming Concepts
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programming
 
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented concepts
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles
 
Knut Morris Pratt Algorithm
Knut Morris Pratt AlgorithmKnut Morris Pratt Algorithm
Knut Morris Pratt Algorithm
 
.Net slid
.Net slid.Net slid
.Net slid
 
Oop’s Concept and its Real Life Applications
Oop’s Concept and its Real Life ApplicationsOop’s Concept and its Real Life Applications
Oop’s Concept and its Real Life Applications
 
Constructor and encapsulation in php
Constructor and encapsulation in phpConstructor and encapsulation in php
Constructor and encapsulation in php
 
Oops
OopsOops
Oops
 
SSRP Self Learning Guide Maths Class 10 - In Hindi
SSRP Self Learning Guide Maths Class 10 - In HindiSSRP Self Learning Guide Maths Class 10 - In Hindi
SSRP Self Learning Guide Maths Class 10 - In Hindi
 
Unit i
Unit iUnit i
Unit i
 
Labsheet2
Labsheet2Labsheet2
Labsheet2
 
Labsheet_3
Labsheet_3Labsheet_3
Labsheet_3
 
Oops Concepts
Oops ConceptsOops Concepts
Oops Concepts
 
Introduction - Imperative and Object-Oriented Languages
Introduction - Imperative and Object-Oriented LanguagesIntroduction - Imperative and Object-Oriented Languages
Introduction - Imperative and Object-Oriented Languages
 
Introduction to object oriented language
Introduction to object oriented languageIntroduction to object oriented language
Introduction to object oriented language
 

Similar to 4 pillars of OOPS CONCEPT

Similar to 4 pillars of OOPS CONCEPT (20)

My c++
My c++My c++
My c++
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.
 
Php oop (1)
Php oop (1)Php oop (1)
Php oop (1)
 
OOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdfOOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdf
 
Object-oriented programming (OOP) with Complete understanding modules
Object-oriented programming (OOP) with Complete understanding modulesObject-oriented programming (OOP) with Complete understanding modules
Object-oriented programming (OOP) with Complete understanding modules
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1
 
I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)
 
Opp concept in c++
Opp concept in c++Opp concept in c++
Opp concept in c++
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Mca 504 dotnet_unit3
Mca 504 dotnet_unit3Mca 504 dotnet_unit3
Mca 504 dotnet_unit3
 
Unit 5.ppt
Unit 5.pptUnit 5.ppt
Unit 5.ppt
 
Diving in OOP (Day 1) : Polymorphism and Inheritance (Early Binding/Compile T...
Diving in OOP (Day 1) : Polymorphism and Inheritance (Early Binding/Compile T...Diving in OOP (Day 1) : Polymorphism and Inheritance (Early Binding/Compile T...
Diving in OOP (Day 1) : Polymorphism and Inheritance (Early Binding/Compile T...
 
C++ Version 2
C++  Version 2C++  Version 2
C++ Version 2
 
Selenium Training .pptx
Selenium Training .pptxSelenium Training .pptx
Selenium Training .pptx
 
concept of oops
concept of oopsconcept of oops
concept of oops
 
The smartpath information systems c plus plus
The smartpath information systems  c plus plusThe smartpath information systems  c plus plus
The smartpath information systems c plus plus
 
C++Day-1 Introduction.ppt
C++Day-1 Introduction.pptC++Day-1 Introduction.ppt
C++Day-1 Introduction.ppt
 
OOP-Advanced Programming with c++
OOP-Advanced Programming with c++OOP-Advanced Programming with c++
OOP-Advanced Programming with c++
 
OOP-Advanced_Programming.pptx
OOP-Advanced_Programming.pptxOOP-Advanced_Programming.pptx
OOP-Advanced_Programming.pptx
 

More from Ajay Chimmani

24 standard interview puzzles - Secret mail puzzle
24 standard interview puzzles - Secret mail puzzle24 standard interview puzzles - Secret mail puzzle
24 standard interview puzzles - Secret mail puzzleAjay Chimmani
 
24 standard interview puzzles - The pot of beans
24 standard interview puzzles - The pot of beans24 standard interview puzzles - The pot of beans
24 standard interview puzzles - The pot of beansAjay Chimmani
 
24 standard interview puzzles - How strog is an egg
24 standard interview puzzles - How strog is an egg24 standard interview puzzles - How strog is an egg
24 standard interview puzzles - How strog is an eggAjay Chimmani
 
24 standard interview puzzles - 4 men in hats
24 standard interview puzzles - 4 men in hats24 standard interview puzzles - 4 men in hats
24 standard interview puzzles - 4 men in hatsAjay Chimmani
 
Aptitude Training - TIME AND DISTANCE 3
Aptitude Training - TIME AND DISTANCE 3Aptitude Training - TIME AND DISTANCE 3
Aptitude Training - TIME AND DISTANCE 3Ajay Chimmani
 
Aptitude Training - PIPES AND CISTERN
Aptitude Training - PIPES AND CISTERNAptitude Training - PIPES AND CISTERN
Aptitude Training - PIPES AND CISTERNAjay Chimmani
 
Aptitude Training - PROFIT AND LOSS
Aptitude Training - PROFIT AND LOSSAptitude Training - PROFIT AND LOSS
Aptitude Training - PROFIT AND LOSSAjay Chimmani
 
Aptitude Training - SOLID GEOMETRY 1
Aptitude Training - SOLID GEOMETRY 1Aptitude Training - SOLID GEOMETRY 1
Aptitude Training - SOLID GEOMETRY 1Ajay Chimmani
 
Aptitude Training - SIMPLE AND COMPOUND INTEREST
Aptitude Training - SIMPLE AND COMPOUND INTERESTAptitude Training - SIMPLE AND COMPOUND INTEREST
Aptitude Training - SIMPLE AND COMPOUND INTERESTAjay Chimmani
 
Aptitude Training - TIME AND DISTANCE 4
Aptitude Training - TIME AND DISTANCE 4Aptitude Training - TIME AND DISTANCE 4
Aptitude Training - TIME AND DISTANCE 4Ajay Chimmani
 
Aptitude Training - TIME AND DISTANCE 1
Aptitude Training - TIME AND DISTANCE 1Aptitude Training - TIME AND DISTANCE 1
Aptitude Training - TIME AND DISTANCE 1Ajay Chimmani
 
Aptitude Training - PROBLEMS ON CUBES
Aptitude Training - PROBLEMS ON CUBESAptitude Training - PROBLEMS ON CUBES
Aptitude Training - PROBLEMS ON CUBESAjay Chimmani
 
Aptitude Training - RATIO AND PROPORTION 1
Aptitude Training - RATIO AND PROPORTION 1Aptitude Training - RATIO AND PROPORTION 1
Aptitude Training - RATIO AND PROPORTION 1Ajay Chimmani
 
Aptitude Training - PROBABILITY
Aptitude Training - PROBABILITYAptitude Training - PROBABILITY
Aptitude Training - PROBABILITYAjay Chimmani
 
Aptitude Training - RATIO AND PROPORTION 4
Aptitude Training - RATIO AND PROPORTION 4Aptitude Training - RATIO AND PROPORTION 4
Aptitude Training - RATIO AND PROPORTION 4Ajay Chimmani
 
Aptitude Training - NUMBERS
Aptitude Training - NUMBERSAptitude Training - NUMBERS
Aptitude Training - NUMBERSAjay Chimmani
 
Aptitude Training - RATIO AND PROPORTION 2
Aptitude Training - RATIO AND PROPORTION 2Aptitude Training - RATIO AND PROPORTION 2
Aptitude Training - RATIO AND PROPORTION 2Ajay Chimmani
 
Aptitude Training - PERMUTATIONS AND COMBINATIONS 2
Aptitude Training - PERMUTATIONS AND COMBINATIONS 2Aptitude Training - PERMUTATIONS AND COMBINATIONS 2
Aptitude Training - PERMUTATIONS AND COMBINATIONS 2Ajay Chimmani
 
Aptitude Training - PERCENTAGE 2
Aptitude Training - PERCENTAGE 2Aptitude Training - PERCENTAGE 2
Aptitude Training - PERCENTAGE 2Ajay Chimmani
 
Aptitude Training - PERCENTAGE 1
Aptitude Training - PERCENTAGE 1Aptitude Training - PERCENTAGE 1
Aptitude Training - PERCENTAGE 1Ajay Chimmani
 

More from Ajay Chimmani (20)

24 standard interview puzzles - Secret mail puzzle
24 standard interview puzzles - Secret mail puzzle24 standard interview puzzles - Secret mail puzzle
24 standard interview puzzles - Secret mail puzzle
 
24 standard interview puzzles - The pot of beans
24 standard interview puzzles - The pot of beans24 standard interview puzzles - The pot of beans
24 standard interview puzzles - The pot of beans
 
24 standard interview puzzles - How strog is an egg
24 standard interview puzzles - How strog is an egg24 standard interview puzzles - How strog is an egg
24 standard interview puzzles - How strog is an egg
 
24 standard interview puzzles - 4 men in hats
24 standard interview puzzles - 4 men in hats24 standard interview puzzles - 4 men in hats
24 standard interview puzzles - 4 men in hats
 
Aptitude Training - TIME AND DISTANCE 3
Aptitude Training - TIME AND DISTANCE 3Aptitude Training - TIME AND DISTANCE 3
Aptitude Training - TIME AND DISTANCE 3
 
Aptitude Training - PIPES AND CISTERN
Aptitude Training - PIPES AND CISTERNAptitude Training - PIPES AND CISTERN
Aptitude Training - PIPES AND CISTERN
 
Aptitude Training - PROFIT AND LOSS
Aptitude Training - PROFIT AND LOSSAptitude Training - PROFIT AND LOSS
Aptitude Training - PROFIT AND LOSS
 
Aptitude Training - SOLID GEOMETRY 1
Aptitude Training - SOLID GEOMETRY 1Aptitude Training - SOLID GEOMETRY 1
Aptitude Training - SOLID GEOMETRY 1
 
Aptitude Training - SIMPLE AND COMPOUND INTEREST
Aptitude Training - SIMPLE AND COMPOUND INTERESTAptitude Training - SIMPLE AND COMPOUND INTEREST
Aptitude Training - SIMPLE AND COMPOUND INTEREST
 
Aptitude Training - TIME AND DISTANCE 4
Aptitude Training - TIME AND DISTANCE 4Aptitude Training - TIME AND DISTANCE 4
Aptitude Training - TIME AND DISTANCE 4
 
Aptitude Training - TIME AND DISTANCE 1
Aptitude Training - TIME AND DISTANCE 1Aptitude Training - TIME AND DISTANCE 1
Aptitude Training - TIME AND DISTANCE 1
 
Aptitude Training - PROBLEMS ON CUBES
Aptitude Training - PROBLEMS ON CUBESAptitude Training - PROBLEMS ON CUBES
Aptitude Training - PROBLEMS ON CUBES
 
Aptitude Training - RATIO AND PROPORTION 1
Aptitude Training - RATIO AND PROPORTION 1Aptitude Training - RATIO AND PROPORTION 1
Aptitude Training - RATIO AND PROPORTION 1
 
Aptitude Training - PROBABILITY
Aptitude Training - PROBABILITYAptitude Training - PROBABILITY
Aptitude Training - PROBABILITY
 
Aptitude Training - RATIO AND PROPORTION 4
Aptitude Training - RATIO AND PROPORTION 4Aptitude Training - RATIO AND PROPORTION 4
Aptitude Training - RATIO AND PROPORTION 4
 
Aptitude Training - NUMBERS
Aptitude Training - NUMBERSAptitude Training - NUMBERS
Aptitude Training - NUMBERS
 
Aptitude Training - RATIO AND PROPORTION 2
Aptitude Training - RATIO AND PROPORTION 2Aptitude Training - RATIO AND PROPORTION 2
Aptitude Training - RATIO AND PROPORTION 2
 
Aptitude Training - PERMUTATIONS AND COMBINATIONS 2
Aptitude Training - PERMUTATIONS AND COMBINATIONS 2Aptitude Training - PERMUTATIONS AND COMBINATIONS 2
Aptitude Training - PERMUTATIONS AND COMBINATIONS 2
 
Aptitude Training - PERCENTAGE 2
Aptitude Training - PERCENTAGE 2Aptitude Training - PERCENTAGE 2
Aptitude Training - PERCENTAGE 2
 
Aptitude Training - PERCENTAGE 1
Aptitude Training - PERCENTAGE 1Aptitude Training - PERCENTAGE 1
Aptitude Training - PERCENTAGE 1
 

Recently uploaded

_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 

Recently uploaded (20)

_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 

4 pillars of OOPS CONCEPT

  • 1. The four pillars of object oriented programming development : 1. Encapsulation : Encapsulation is one of the fundamental concept of OOP's. It refers to the bundling (combining) of data with the methods (member functions that operate on that data) into a single entity (like wrapping of data and methods into a capsule) called an Object. It is used to hide the values or state of a structured data object inside a class, preventing unauthorized parties, direct access with them. Publicly accessible methods are generally provided in the class to access the values, and other client classes call these methods to retrive and modify the values within the object. We generally call the functions that are declared in c++ are called as Member functions. But in some Object Oriented languages (OO's) we call them as Methods. Also the data members are called Attributes or Instance variables. Take a look with an example : #include<iostream> using namespace std; class s { public: For references : http://comsciguide.blogspot.com/
  • 2. int count; // data member of the class s() // constructor { count=0; // data member initialization } int disp() // method of the same class { return count; } void addcount(int a) //method of the same class { count=count+a; } }; int main() { s obj; obj.addcount(1); obj.addcount(4); obj.addcount(9); cout<<obj.count; // output : 14 return 0; } In the above example u can observe that all tha data members and methods are binded into a object called “obj”. In Encapsulation we can declare data members as private, protected, or public. So we can directly access the For references : http://comsciguide.blogspot.com/
  • 3. data members (here count). Features and Advantages of concept of Encapsulation : • Makes maintenance of program easier . • Improves the understandability of the program. • As the data members and functions are bundled inside the class, human errors are reduced. • Encapsulation is alone a powerful feature that leads to information hiding, abstract data type and friend functions. WWW.COMSCIGUIDE.BLOGSPOT.COM 2.Data Hiding : The concept of encapsulation shows that a non -member function cannot access an object's private or protected data. This has leads to the new concept of data hiding. Data Hiding is a technique specifically used in object oriented programming(OOP) to hide the internal object details (data members or methods) from being accessible to outside users and unauthorised parties. The Private access modifier was introduced to provide that protection. Thus it keeps safe both the data and methods from outside interference and misuse. In data hiding, the data members must be private. The programmer must For references : http://comsciguide.blogspot.com/
  • 4. explicitly define a get or set method to allow another object to read or modify these values. For example : class s { int count; // data member of the class // default members are private public: s() // constructor { count=0; // data member initialization } int disp() // method of the same class { return count; } void addcount(int a) //method of the same class { count=count+a; } }; int main() { s obj; obj.addcount(1); obj.addcount(4); obj.addcount(9); cout<<obj.disp(); For references : http://comsciguide.blogspot.com/
  • 5. return 0; } Here the data member count is private. So u can't access it directly. Instead u can access it, by the methods of the same class. Here It is accessed by the disp method . • In some cases of two classes, the programmer might require an unrelated function to operate on an object of two classes. The programmer then able to utilize the concept of friend functions. • It enhances the security and less data complexity • The focus of data encapsulation is on the data inside the capsule while that data hiding is concerned with restrictions and allowance in terms of access and use. WWW.COMSCIGUIDE.BLOGSPOT.COM 3.Inheritance: Reusability is yet another important feature of OOP's concept. It is always nice, if we could reuse something instead of creating the same all over again. For instance, the reuse of a class that has already tested and used many times can save the effort of developing and testing it again. For references : http://comsciguide.blogspot.com/
  • 6. C++ supports the concept of reusability. Once a class has written and tested, it can be adapted by other programmers to suit their requirements. This is done by creating new classes, and reusing the existing properties. The mechanism of deriving a new class from old one is called Inheritance. The old class is referred as “Base class”. And the new one created is called as “Derived class”. For references : http://comsciguide.blogspot.com/ FEATURE A FEATURE C FEATURE B FEATURE A FEATURE C FEATURE B FEATURE D DERIVED FROM BASE CLASSDERIVED FROM BASE CLASS BASE CLASSBASE CLASS DERIVED CLASSDERIVED CLASS
  • 7. Here is an example : #include<iostream> using namespace std; class e { public: int a; void b() { a=10; } }; class c : public e // public inheritance { public: void d() { cout<<a<<endl; } }; int main() { c ab; ab.b(); ab.d(); } For references : http://comsciguide.blogspot.com/
  • 8. Here a is declared in the base class e and is inherited in the class c so that we need not to it declare again. • Reusing existing code saves time and increases a program's reliability. • An important result of reusability is the ease of distributing class libraries. A programmer can use a class created by another person or company, and without modifying it, derive other classes from it that are suited to their requirements. WWW.COMSCIGUIDE.BLOGSPOT.COM 4.POLYMORPHISM: Polymorphism -- “one interface, multiple methods.” Polymorphism occurs when there is a hierarchy of classes and they are related by inheritance. Generally, from the Greek meaning Polymorphism is the ability to appear in many forms (having multiple forms) and to redefine methods for derived classes. A real-world example of polymorphism is a thermostat. No matter what type of furnace your house has(gas, oil, electric, etc), the thermostat works in the same way. In this case, the thermostat (which is the interface) is the same, no matter what type of furnace (method) you have. For example, if For references : http://comsciguide.blogspot.com/
  • 9. you want a 70-degree temperature, you set the thermostat to 70 degrees. It doesn't matter what t ype of furnace actually provides the heat. This same principle can also apply to programming. For example, you might have a program that defines three different types of stacks. One stack is used for integer values, one for character values, and one for floating-point values. You can define one set of names, push( ) and pop( ) that can be used for all three stacks. In your program, you will create three specific versions of these functions, one for each type of stack, but names of the functions should be same. The compiler will automatically select the right function based upon the data being stored. Thus, the interface to a stack -- the functions push( ) and pop( ), are the same no matter which type of stack is being used. The individual versions of these functions define the specific implementations (methods) for each type of data. • Polymorphism reduces complexity by allowing the same interface to be used to access class of actions. It is the compiler's job to select the specific action (method) to each situation. Also see : 1.Programs those work in C but not in C++ 2.Difference between malloc(),calloc(),realloc() 3.Dynamic memory allocation (Stack vs Heap) 4.3 ways to solve recurrence relations For references : http://comsciguide.blogspot.com/
  • 10. WWW.COMSCIGUIDE.BLOGSPOT.COM For references : http://comsciguide.blogspot.com/