Module definitions Flashcards
What is an OO language
A language which promotes or allows object oriented programming and design
What is an object?
A collection of data
What is a class?
Defines what an object can do
What is a class method?
A static method which is associated with a class
What is an instance method?
A non-static method which is associated with an object
What is aggregation?
An object within an object where the inner object has a lifetime of its own
What is the symbol for aggregation in a class diagram?
An empty diamond
What is composition?
An object within object where the inner object lasts as long as the outer object
What is the symbol for composition in class diagram?
A black filled in diamond
What is abstraction?
Hides the implementation from the user for simplicity
What is an abstract method?
A method without implementation (no {}) - these are placeholders for sub-classes to implement/override
What is an abstract class?
A class with at least one abstract method- CANNOT create instances of the class (only references)
What is an interface?
A class where every method is abstract and any data is static and final. (a class with no implementation)
What is inheritance?
A class is as specialisation of another class
What is the symbol for inheritance in a class diagram?
A white arrow
How does inheritance work with classes?
A class extends a class
How does inheritance work with a class and an interfaces?
A class implements an interface
How does inheritance work with interfaces?
An interface extends an interface
How does inheritance work with interfaces and classes?
DOESNT WORK THIS WAY -> a class can implement an interface not the other way round
What is parametric polymorphism?
Code which works with multiple different types
What is type erasure?
Type exists only at compile time and are erased before runtime
What is ad-hoc polymorphism
Function overloading -> same function name but multiple different versions depending on the parameter types