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

Lecture 1

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)
4 views21 pages

Lecture 1

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/ 21

Lecture 3

Advanced Programming in C++


Object-Oriented Programming (OOP)
➢The concept of OOP isn’t related to the specific programming language (IP).

➢Several programming language supports the programming paradigm OOP, such as Java
and C#.

➢The programming paradigm is one of the styles of programming that is used to develop
software systems.

➢object-oriented programming languages provide statements for describing objects and


their behavior.

➢In the object-oriented paradigm, a template for a collection of objects is called a class.
Object-Oriented Programming (OOP)
Object-Oriented Programming is a methodology to build software
systems.

Programing languages are tools to build software systems.

The C++ programing language supports two paradigms which are


procedural programming and Object-Oriented Programming.
Procedural Programming and the Object-
Oriented Programming paradigms.

In the procedural paradigm, we


think about building systems such
as a set of functions. Each function
can be called another function.
Procedural Programming and the Object-
Oriented Programming paradigms .
In the case of building a program
based on the Object-Oriented
Programming paradigm, we focus
on finding the objects that the
system is built based on it. The
object is a thing (tangible or
intangible)
Example:

Objects of a college management system

Course
Teacher Section Hall
Example:

Objects of online shop program

Product Customer Cashier


The object is comprised of data and operations.
Data = Behaviors = Attributes = Properties.
Attributes is a data that describe the object.
Function = Method = Operations .
Operations are executed using the data of the object.
Student

Data Functions ()

1-Student-name 1- change-study-level()
2-Address 2- print-student-name()
3-GPA 3-print-student-
4-ID address()
5- Study-level 4- modify-GPA()
Product

Data
Functions ()
1-product name
1- Discount
2-Product-code
2- Print-Product name()
3-Price
3-Print-product-price()
4-Discount rate
4- modify-price()
5-Producer
The main steps to develop each system are by
using the OOP paradigm.
Step 1: Determine the objects that we need in the developed
system.
Step 2: Determine the set of attributes for each object.
Step 3: Determine the set of operations.
Example:
Implement a simple C++ program using the following steps :
1)Define a class GradeBook with a member function displayMessage.
This function prints a message on the screen "welcome to the grade-
book program".
2)Create a GradeBook object named myGradeBook and call its member
function in the main function of the program.
Example
Class Declarations
// x is declared to be an object of the Ratio class
Outputs

Ratio x,y,z; // x, y, z are declared to be an object of the Ratio class

You might also like