Lec 6: Introduction To OOP: DR Ziaul Hossain
Lec 6: Introduction To OOP: DR Ziaul Hossain
• repeat the process with each new piece until each can
be solved directly, without further decomposition.
• Top-down approach
– Level 0: display square of the maximum number
– Next level:
• Make an array to store 10 integers
• Find maximum of these integers
• Find square of that number
• Print the square
F3(. . .){
. . .
}
• the storage structure of the data and the code for the
subroutines in a module may be altered without affecting
programs that make use of the module as long as the
published interfaces and the module’s functionality remain
the same
• Example
• A student-records object
– ID, Name, Address, Courselist etc. (internal state)
– Add a new student , add a course, print the student
information (messages)
Dept. of Electrical & Computer
Date Slide 8
Engineering (ECE)
Realising The Interaction Between
Objects
• Consider the following exchange between two people:
– First person: Jack, are you hungry?
– Second Person: Yes I am, Jill.
Are you hungry?
Name Name
JACK JILL
Question Question
Answer Yes, I am Answer
Class
<CAR>
Object
<7_series_BMW Object
> <VW_Beetle
>
Object
<Ford_Mustang
>
“Start the
engine of the Object
BMW” <7_series_BMW>
Start_Engine
Class
<CAR>
Start_Engine
• Field Declaration
– a type name followed by the field name, and optionally an
initialization clause
– primitive data type vs. Object reference
• boolean, char, byte, short, int, long, float, double
– field declarations can be preceded by different modifiers
• access control modifiers
• static
• final