Week 4 Flashcards
What are the advantages of object oriented design?
Can save effort - reuse generalised components
Can improve quality - modularity, loosely coupled subsystems
What are the 3 components of an object?
State
Behaviour
Identity
In OOP, __________ are the primary means of abstraction.
Objects
What is information hiding?
Only an object’s Interface is visible to other objects
Inheritance is how object oriented languages implement
generalisation/specialisation
What is inheritance?
When the whole description of a superclass applies to all its subclasses
‘implements’ is how java implements
Subtyping
‘extends’ is how java implements
Subclassing
What is the difference between subtyping and subclassing?
Subtypes support all the operations on the supertype
Subclassing reuse the code of the superclass and can add extra methods
What is generalisation?
is-kind-of
Superclass is a generalization of subclass
e.g. Teacher is a kind of Person
Subtyping is also known as an _______ relationship
is-a
What does polymorphism allow?
One message to be sent to multiple objects of different classes
What are 3 kinds of polymorphism?
Overloading
Dynamic Binding
Genericity
What is overloading?
Method of the same name is defined for different argument types
What is dynamic binding?
When a message is dispatched, the method that is invoked is chosen according to the type of the object (i.e. at runtime).