SE101 Lec2 ObjectsClasses (2)
SE101 Lec2 ObjectsClasses (2)
States
Behaviors
Methods
Message
Passing
Constructors
Some objects are different from each
other, some are similar.
Each type of object has particular
attributes and behavior.
The class is a specification of the
Classes attributes and behavior.
Properties? Actions?
Example: caption set caption
position set position
size set size
font set font
... ...
Type?
Button OK
Objects are instances of a class.
So the class describes what an object
is like.
An object is a concrete 'thing' that
has the properties and actions
Objects described by its class.
An object is realised using the class to
btnExit
determine
what it knows btnOK
what it does.
Button
btnCancel
Objects are not used in isolation.
Programm Object-oriented programs are usually based
on a number of objects that work together
ing with to achieve the desired result.
objects Some tasks would be difficult/impossible to
program without using an OO approach!
Collaborating objects
student[1]: Student this is a UML
object type
representation
name = Jones, Peter object id of an object
regNo = 10023456
dateOfBirth = 01/04/86
course[1]: Course
student[2]: Student
code = G567
name = Peters, Anne name = Software Engineering
regNo = 10023459 type = BSc Hons
dateOfBirth = 01/04/82 manager = Mary Squire
folders Package:
collection of classes, like a library
and package name – all lower case
The
constructo 0021
r - how it module
0021 is the 1 coursewor 65 0021
works identity of the exam
k 60 0025
object, i.e. the first
memory location
of its data storage.
This identity is Computer memory
stored in the
variable
module1.
Must:
have the same name as the class,
not have a return type.
More on OOP…..
Encapsulation
THANK YOU
Inheritance
Polymorphism