0% found this document useful (0 votes)
50 views17 pages

Lecture - 1

This document discusses object-oriented programming (OOP) concepts in C++. It defines OOP as a programming paradigm that represents everything as objects, with key concepts like classes, objects, inheritance, polymorphism, abstraction and encapsulation. Inheritance allows a class to acquire properties of its parent class. Polymorphism means an object can have many forms. Abstraction hides internal details and shows functionality, while encapsulation binds code and data into a single unit. OOP makes development and maintenance easier compared to procedural programming as programs grow.

Uploaded by

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

Lecture - 1

This document discusses object-oriented programming (OOP) concepts in C++. It defines OOP as a programming paradigm that represents everything as objects, with key concepts like classes, objects, inheritance, polymorphism, abstraction and encapsulation. Inheritance allows a class to acquire properties of its parent class. Polymorphism means an object can have many forms. Abstraction hides internal details and shows functionality, while encapsulation binds code and data into a single unit. OOP makes development and maintenance easier compared to procedural programming as programs grow.

Uploaded by

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

Object Oriented Programming

(OOP)

Using C++

Lecture #1

1 Edrak Uiversity
C++ OOPs Concept

 The major purpose of C++ programming is to


introduce the concept of object orientation to
the C programming language.
 Object Oriented Programming is a Paradigm
that provides many concepts such as:
Inheritance, Data Binding, Polymorphism etc.

2 Edrak Uiversity
Cont…

 The programming paradigm where everything


is represented as an Object is known as truly
Object-Oriented Programming Language.

 Smalltalk is considered as the first truly


Object-oriented Programming Language.

3 Edrak Uiversity
OOPs (Object Oriented Programming System)

 Object-Oriented Programming is a methodology


or paradigm to design a program using classes
and objects.

 It simplifies the software development and


maintenance by providing some concepts:

4 Edrak Uiversity
Cont…

• Object
• Class
• Inheritance
• Polymorphism
• Abstraction
• Encapsulation

5 Edrak Uiversity
Object & 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.
4
6 Edrak Uiversity
Cont…

7 Edrak Uiversity
C++ OOPs Concept

Inheritance
 When one object acquires all
the properties and behaviors
of parent object known as
inheritance.
 It provides code reusability
when a class includes
property of another class.
8 Edrak Uiversity
C++ OOPs Concept

Polymorphism
 Polymorphism is a feature using which an
object behaves differently in different situation.

 It means that an object can have many forms.

 In C++, we use Function overloading and


Function overriding to achieve Polymorphism.

9 Edrak Uiversity
Cont…

10 Edrak Uiversity
Cont…

Polymorphism
real example:
a person at the
same time can
have different
characteristics.

11 Edrak Uiversity
C++ OOPs Concepts

Abstraction
 Hiding internal details and
showing functionality is
known as abstraction.
 For example: phone call,
we don't know the internal
processing.
 In C++, we use abstract
class and interface to
achieve abstraction.

12 Edrak Uiversity
C++ OOPs Concepts

Encapsulation
 Binding (or wrapping) code and data together
into a single unit is known as encapsulation.
 Encapsulation is a process of combining data
members and functions in a single unit called
class.
 For example: capsule, it is wrapped with
different medicines.
13 Edrak Uiversity
Cont…

For example: capsule, it is wrapped with different


medicines.

14 Edrak Uiversity
Advantage of OOPs over Procedure-Oriented
Programming Language

 OOPs makes development and maintenance easier


where as in Procedure-oriented programming
language it is not easy to manage if code grows as
project size grows.
 OOPs provide data hiding whereas in Procedure-
oriented programming language a global data can be
accessed from anywhere.
 OOPs provide ability to simulate real-world event
much more effectively. We can provide the solution
of real word problem if we are using the Object-
15 Oriented Programming Language. Edrak Uiversity
Questions?

16 Edrak Uiversity
Thanks
17 Edrak Uiversity

You might also like