1/13
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Inheritance
The process of creating a new class based on an existing class (superclass)
Superclass
The class that is being inherited from
Subclass
The class that is inheriting from the superclass
Polymorphism
A concept in programming that allows an object to take on different forms or behaviours
Overriding
A method of polymorphism where the same identifier in the superclass is redefined in the subclass
Association
The relationship between two classes
Aggregation
An association where one class contains or references another, but can still exist independently from the the other class
Composition
A strong association where one class contains another contained class that is fully dependent on the container. If the container is destroyed, the contained object is also destroyed.
Abstract method
A method declared in an abstract class that does not have an implementation. Instead, it is used as a placeholder and must be overridden by subclass methods.
Virtual method
A method declared with an implementation in a regular class that can be optionally overridden or inherited from by other subclasses
Static method
A method that is relevant to all the instances of a class, rather than to any specific instance, and can be run without creating an object. (It essentially groups a bunch of methods under one class name for clarity, used in a lot of python libraries, e.g pygame.display.update())
Interface
A collection of abstract methods that a class must implement
OOP design principles
Encapsulate what varies
Favour composition over inheritance
Program to interfaces, not implementation
Why is the OOP paradigm used?
Modularity - Breaks down code into classes and objects with clear responsibilities
Reusability - Through inheritance, existing code can be used without rewriting
Maintainability - OOP is easier to understand and update
Encapsulation - Internal object data is hidden from the outside interface