9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
Basic oop concepts - C++
1. Click to edit Master title style
1
WITH REAL LIFE EXAMPLES
BASIC OOP
CONCEPTS
By
GROUP 2
2. Click to edit Master title style
2
Basic Concepts of Object-Oriented Programming
• Classes
• Objects
• Data Abstraction
• Encapsulation
• Inheritance
• Polymorphism
• Dynamic Binding
• Message passing
2
Four pillars of OOP concept
3. Click to edit Master title style
3
DATA ABSTRACTION
• Data Abstraction is the process of showcasing only
the required things to the outside world while hiding
the details.
• It is the most important pillar in OOPS.
• On using the example of mobiles ,
While dialing some methods happen internally
which concatenate the numbers and displays it on
screen but what it is actually doing is unknown to us.
Clicking on green button actual send signals to
calling person's mobile but we are unaware of how it 3
4. Click to edit Master title style
4
• In classes , we can create methods that can
be called and used by the users of the class
but users will have no idea what these
methods do internally.
4
5. Click to edit Master title style
5
ENCAPSULATION
• Data binding – binds data variables and
functions together in class.
• The data can be accessed only by the
functions within the class and not by the
outside world.
• It says how much access must be given to
particular details.
• This insulation of data is called data hiding/
information hiding.
5
6. Click to edit Master title style
6
Example 1 – Mobile phones
6
• When we switch on a Bluetooth,
we can connect to another
Bluetooth enabled device, but we
don’t have access to other mobile
features like dialing number,
accessing inbox etc.
• This is because Bluetooth has some
level of abstraction. Encapsulation
and abstraction go hand in hand.
• Similarly, when mobile A is
connected to mobile B and mobile
B is connected to mobile C via
Bluetooth , the A can’t connect to
C via B.
7. Click to edit Master title style
7
Example 2 – Human body
7
• Different body parts are bound to do
different functions.
• For example,
Hands - Hold()
Legs - Walk()
Eyes - See()
8. Click to edit Master title style
8
INHERITANCE
• Ability to extend the functionality from base
entity in new entity belonging to same group.
• Helps to reuse functionality.
• 5 types:
1. Single level inheritance
2. Multi-level inheritance
3. Hybrid inheritance
4. Hierarchal inheritance
5. Multiple inheritance
8
9. Click to edit Master title style
9
Types Of Inheritance
9
Single level inheritance Multi-level inheritance
• Single base class & a single
derived class.
• More than one single level of
derivation.
10. Click to edit Master title style
1010
Hierarchal level inheritance Hybrid inheritance
• Multiple derived class would be extended
from base class.
• Similar to single level inheritance.
• Single, Multilevel & hierarchal inheritance
all together construct a hybrid
inheritance.
11. Click to edit Master title style
11
Multiple inheritance
Derived class will ex t en d from mu lt iple base
classes.
11
12. Click to edit Master title style
12
POLYMORPHISM
• Polymorphism can be defined as the ability of using same
name for doing different things.
• Many forms of single entity.
• Let's consider our example, Samsung mobile has a 5MP
camera available i.e. – it is having a functionality of, say,
CameraClick(). Now same mobile is having Panorama mode
available in camera, so functionality would be same but with
mode. This type is said to be Static polymorphism or
Compile time polymorphism.
12
13. Click to edit Master title style
13
• Another point where in function ,say, SendMessage()
was intended to send message to single person at a
time but suppose Nokia had given provision for
sending message to a group at once. i.e. - Overriding
the functionality to send message to a group. This
type is called Dynamic polymorphism or Runtime
polymorphism.
• For overriding you need to set the method, which can
be overridden to virtual & its new implementation
should be decorated with override keyword.
• By runtime polymorphism, we can point to any 13
14. Click to edit Master title style
14
“
Another trick in software is to avoid rewriting
the software by using a piece that's already
been written, so called component approach
which the latest term for this in the most
advanced form is what's called Object
Oriented Programming.
- Bill Gates
14