OOP Flashcards
Define a Class
A definition (or blueprint) of an object, its methods and its behaviours
Define an Object
An entity defined by its attributes and methods. (The entity modelled. Like a car.)
Define Instantiation
Creating software objects from class definitions
Define Encapsulation
Making the attributes of a class private, only allowing it to be shown through methods.
Define a reference variable
A variable set to an instance of an object
Define inheritance
When one class (child) receives some of the attributes and methods of an existing class (parent)
Define Overriding
When a method is changed and overwritten by a child class
Define Association
When 2 classes are not inherited from one another, but have a relationship to one another.
Define Aggregation
When the 2 classes can exist without each other
Define Composition
When one class cannot exist without another.
What does the phrase: “Favour composition over inheritance” mean?
Inheritance can be complex and allow too much to be inherited; composition is often more realistic and pragmatic
What does the phrase “Encapsulate what varies” mean?
Use private attributes & public methods
What does the phrase “Program to interfaces, not implementation” mean?
Interface provides an abstraction, hides complexities of system from a user and can have different implementations for the same interface
Define Polymorphism
When a method of a child and parent class is the same, but the behaviour is different
Define a class definition
Template or blueprint used to define object