0% found this document useful (0 votes)
52 views21 pages

Object Oriented Programming

Object-oriented programming uses objects and classes as fundamental building blocks. A class defines common attributes and behaviors of objects. Objects are instances of classes and inherit attributes and behaviors from parent classes in a hierarchy. The key aspects of object-oriented programming are abstraction, encapsulation, modularity, and hierarchy.

Uploaded by

pushkar.23182016
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views21 pages

Object Oriented Programming

Object-oriented programming uses objects and classes as fundamental building blocks. A class defines common attributes and behaviors of objects. Objects are instances of classes and inherit attributes and behaviors from parent classes in a hierarchy. The key aspects of object-oriented programming are abstraction, encapsulation, modularity, and hierarchy.

Uploaded by

pushkar.23182016
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Object Oriented

Programming
Object-Oriented Programming
Object-oriented programming is a method of implementation in which programs are
organized as cooperative collections of objects, each of which represents an instance of some
class, and whose classes are all members of a hierarchy of classes united via inheritance
relationships.

There are three important parts to this definition:


(1) Object-oriented programming uses objects, not algorithms, as its fundamental logical building
blocks.
(2) Each object is an instance of some class
(3) Classes may be related to one another via inheritance relationships.
A program may appear to be object-oriented, but if any of these elements is missing, it is not an
object-oriented program. Specifically, programming without inheritance is distinctly not object
oriented; that would merely be programming with abstract data types.
Object-Oriented Programming
There are four major elements in object model:
1. Abstraction
2. Encapsulation
3. Modularity
4. Hierarchy
By major, we mean that a model without any one of these elements is not object
oriented.

There are three minor elements of the object model:


1. Typing
2. Concurrency
3. Persistence
Abstraction
Abstraction
Abstraction-India
Abstraction-India
Abstraction-Hierarchy: Example-Employee in LMS
Encapsulation

Abstraction focuses
on the observable behavior of an object, whereas
encapsulation focuses on the
implementation that gives rise to this behavior. For
abstraction to work, implementations must be
encapsulated. Abstraction and encapsulation are
complementary concepts.
Encapsulation: Example-Employee in LMS
Modularity
Modularity
Modularity
Modularity
Hierarchy
Object and Class

Object: Any entity that has state and behavior is known as an object. For example: chair,
pen, table, keyboard, bike etc. It can be physical and logical.

Class: Collection of objects is called class. It is a logical entity.

Derived Classes: A Derived class is defined as the class derived from the base class.
Types Of Inheritance
C++ supports five types of inheritance:
•Single inheritance
•Multiple inheritance
•Hierarchical inheritance
•Multilevel inheritance
•Hybrid inheritance
Types Of Inheritance

Single inheritance is defined as the Multilevel inheritance is a process of


inheritance in which a derived class is deriving a class from another derived class.
inherited from the only one base class.

Where 'A' is the base class,


and 'B' is the derived class.
Types Of Inheritance
Multiple inheritance is the process of Hybrid inheritance is a combination of more
deriving a new class that inherits the than one type of inheritance.
attributes from two or more classes.
Types Of Inheritance
Hierarchical inheritance is defined as the process of deriving more than one class
from a base class.
Visibility mode
Visibility mode: The visibility mode specifies whether the features of the base class
are publicly inherited or privately inherited. It can be public or private.
Visibility modes can be classified into three categories:
•Public: When the member is declared as
public, it is accessible to all the functions of the
program.
•Private: When the member is declared as
private, it is accessible within the class only.
•Protected: When the member is declared as
protected, it is accessible within its own class as
well as the class immediately derived from it.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy