Вы находитесь на странице: 1из 35

AV-223

INTRODUCTION TO
ALGORITHMS AND DATA
STRUCTURES

Object Oriented Concepts

16 April 2020-Academic Week No 01/18


Number of Slides: 35

1
LEARNING OBJECTIVES
• Defining Object Oriented (OO) Concepts

• Objects
• Classes
• Abstraction
• Encapsulation
• Inheritance
• Overloading
• Overriding
• C++ Implementation of Class

2
OBJECT ORIENTED PROGRAMMING
• Object Oriented Programming (OOP)

• Object Oriented programming is a programming style that is associated with the


concept of Class, Objects and various other concepts revolving around these two, like
Inheritance, Polymorphism, Abstraction, Encapsulation etc

3
OOP CONCEPTS FOR LANGUAGES
• Object Oriented Programming C++

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

4
OOP EXPLANANTION
• Brief explanation of OOP

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

5
OOP EXPLANANTION Contd

• Categorization of Human Beings

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

6
OOP EXPLANANTION Contd

• Body Parts and Functions

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

7
OOP EXPLANANTION Contd

• Similarity and differences

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

8
OOP EXPLANANTION Contd

• Body Parts and Functions

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

9
OOP EXPLANANTION Contd

• Explanation using this example

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

10
CLASS DEFINITION
• Class is defined as

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

11
CLASS DEFINITION
• Explanation

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

12
CLASS DEFINITION
• Class or type

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

13
INHERITANCE
• Definition and Concept

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

14
INHERITANCE
• Explanation

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

15
OBJECT DEFINITION
• Definition

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

16
OBJECT DEFINITION
• Brief description

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

17
OBJEC DEFINITION
• Explanation

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

18
ABSTRACTION
• Definition

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

19
ABSTACTION
• Explanation

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

20
ABSTRACTION
• Hidden within some class

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

21
ENCAPSULATION
• Defined as

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

22
ENCAPSULATION
• Description

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

23
ENCAPSULATION
• Explanation

1. Find places you can go from home


2. From those, find all paths
3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

24
ENCAPSULATION
• Private variables that cannot be accessed outside

2. From those, find all paths


3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

25
ENCAPSULATION
• Also referred as Data hiding

2. From those, find all paths


3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

26
POLYMORPHISM
• Definition

2. From those, find all paths


3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

27
POLYMORPHISM
• Multiple ways of explaining

2. From those, find all paths


3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

28
POLYMORPHISM
• Procedure using

2. From those, find all paths


3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

29
POLYMORPHISM
• Types of polymorphism

2. From those, find all paths


3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

30
OVERLOADING
• Overloading in polymorphism

2. From those, find all paths


3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

31
OVERRIDING
• Overriding in polymorphism

2. From those, find all paths


3. Keep track of the distance
4. Repeat the process until you reach school
5. Compare the distances you travelled
6. Find the shortest path

32
Coding Class C++
• Implementation of class using C++

33
Coding Class in C++
• Implementation of class

34
SUMMARY
• Object oriented concepts

• Definition

• Examples

• Coding a class in C++

• Implement and understand figure 1.7, 1.8 and 1.9 of book Chapter 1

35

Вам также может понравиться