0% found this document useful (0 votes)
38 views22 pages

F2010 C++ LANGUAGE: 1.1 Fundamentals of Object-Oriented Programming (OOP)

Here are the definitions for the assignment: 1. A class describes the data and functions of objects. An object is an instance of a class. 2. Data abstraction represents the essential characteristics of an object excluding the background details. 3. Data encapsulation is the process of combining data and its functions in a unit. 4. Inheritance is the capability by which the objects of one class inherit or acquire the characteristics of the objects in another class. 5. Polymorphism is the ability for a function of an object to appear in many forms.

Uploaded by

syaiful bachtiar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views22 pages

F2010 C++ LANGUAGE: 1.1 Fundamentals of Object-Oriented Programming (OOP)

Here are the definitions for the assignment: 1. A class describes the data and functions of objects. An object is an instance of a class. 2. Data abstraction represents the essential characteristics of an object excluding the background details. 3. Data encapsulation is the process of combining data and its functions in a unit. 4. Inheritance is the capability by which the objects of one class inherit or acquire the characteristics of the objects in another class. 5. Polymorphism is the ability for a function of an object to appear in many forms.

Uploaded by

syaiful bachtiar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 22

F2010 C++ LANGUAGE

1.1 Fundamentals of Object-


Oriented Programming (OOP)

Presentation 1
Revision…

1. The language C is a ______ language.


2. What are mathematical operators?
3. How are increment and decrement operators
represented?
4. The operators <, >,<=, >=, = = are called
_____________.
5. The operators && (and operator), || (or operator)
and ! (not operator) are called _____________.
6. Define is an array.
Objectives

At the end of this presentation, you will be able to


• Relate concepts of object orientation to real
life examples
• List and explain the features of OOP
• Describe the advantages of OOP
Object-Oriented Programming
• A relatively new way to program computer
applications.
• Brings programming world closer to the real
world.
• Aims to simplify complex problems and
provide real-world solutions to the problems.
Classes and Objects
• Class describes the data and functions of
objects.
• Object is an instance of the class.
Fruit - Characteristics and Uses
Consider the characteristics and uses of the fruits listed:
Fruit Characteristics Use
Orange Shape: Spherical Is used to
Color: Orange prepare orange
Taste: Sour squash.

Banana Shape: Leaf-shaped Is used to


Color: Yellow, Green prepare banana
Taste: Sweet milk shake.

Apple Shape: Spherical Is used to


Color: Red, Yellow, Green prepare juice.
Taste: Sweet
Fruit - Characteristics and Uses
Fruit
Shape
Color
Taste
Use

Orange Banana Apple


Sphere Leaf Sphere
Orange Yellow Red
Sour Sweet Sweet
Use(Orange) Use(Banana) Use(Apple)
Activity 5.1.1

1. Identify the characteristics and functions of


a Car from the given list:

Drive
Steering wheel
Indicator
Wheel
Acceleration
Activity 5.1.1
2. Write down the classname, the characteristics and
the functions of the class Car in relevant boxes of
the class diagram given.

Classname

Characteristics

Functions
Features of OOP

The basic features of object-oriented programming are

• Data Encapsulation
• Data Abstraction
• Inheritance
• Polymorphism
Data Encapsulation

• The process of combining data and its functions in


a unit.
Example - Data Encapsulation

Sample representation of Class Car:

Car
Classname
Internal Mechanical Parts
Steering
Data Members
Wheels
Member Functions
Turn() Member Functions
Acceleration()
Data Abstraction

• Represents the essential characteristics of an


object excluding the background details.
Example - Data Abstraction
Sample representation of Class Car:
Car Classname
Internal Mechanical Parts
Steering Data Members
Wheels
Member Functions
Turn() Member Functions
Acceleration()
Inheritance

• Capability by which the objects of a class inherit


the characteristics of the objects of another class.
Sample Representation of Class Automobile

Automobile
Engine
Wheels
Move()

Car Car
CC Rating B.H.P
Fuel type Steering type
Activity 5.1.2

1. Identify the base and derived classes from


the given list:
• Square
• Shape
• Rectangle
Polymorphism
Polymorphism means ability to process objects
differently depending on their data type.
Advantages of OOP
• Simple - Software objects are treated similar to real
objects.
• Data Security - Each object can access only the
essential members of the object of the other class.
• Reusable - The inheritance concept in C++
provides the benefit of reusability of code.
• Modularity - C++ allows to divide the program into
modules. Hence it is easy to write, reuse code and
maintain huge programs.
Summary

In this presentation, you learnt the following:


• Class describes the data and functions of
objects.
• Object is an instance of the class.
• Data encapsulation is the process of combining
data and its functions in a unit.
• Data abstraction represents the essential
characteristics of an object excluding the
background details.
Summary

In this presentation, you also learnt the following:


• Inheritance is the capability by which the objects
of one class inherit or acquire the characteristics
of the objects in another class.
• Polymorphism is the ability for a function of an
object to appear in many forms.
Assignment

1. Define: classes and objects.


2. Define: data abstraction.
3. Define: data encapsulation.
4. Define: inheritance.
5. Define: polymorphism.

You might also like