كلية تكنولوجيا الصناعة والطاقة
PEARSON BTEC International Standards Verifier
ICT Program
q
Advanced Programming in C ++ (ICT-D-321 )
Dr. Ghada Maher
Lec. 4 Advanced Programming in C++ 4 March 2024
Outline كلية تكنولوجيا الصناعة والطاقة
Object-Oriented Programming (OOP)
4. 1 Object-Oriented Programming (OOP) كلية تكنولوجيا الصناعة والطاقة
➢The concept of OOP isn’t related to the specific programming language (Pl).
➢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 are 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
كلية تكنولوجيا الصناعة والطاقة
كلية تكنولوجيا الصناعة والطاقة
كلية تكنولوجيا الصناعة والطاقة
كلية تكنولوجيا الصناعة والطاقة
Outputs
Ratio x,y,z; // x, y, z are declared to be an object of the Ratio class
كلية تكنولوجيا الصناعة والطاقة
Task 2:
1- Select a real world problem, Then explain this problem
2-Explain the difference between Object-Oriented Programming (OOP) and programming languages (PL) to
solve this problem using a computer
3-Illustrate the fundamental difference between Procedural Programming and Object-Oriented Programming
paradigms to solve the selected real world problem
4-List the main steps to develop the system of the selected real-world problem by using the OOP paradigm.
Your developed OOP system for selected real world problem should include the following steps
a- Build a class with a member function in a C++ programming language, then create an object and call its
member function in the main function.
b-Implement a constructor, destructor, overloading methods, and static data member in the C++
programming language.
C- Develop number (4.a) to create a class in a separate file using Microsoft Visual Studio C++. Then
Evaluate the significant of placing this class in a separate file.
كلية تكنولوجيا الصناعة والطاقة
In this week's lab, you’ll Apply
Apply the concept of Object-Oriented Programming paradigms to develop a set of programs
كلية تكنولوجيا الصناعة والطاقة
Thank
q
you