Function programming Flashcards
Objects
representations of things that exist in the real world that we wish to model in a computer system
Attribute
data item that helps define or describe the object
Class
blueprint/template for an object and defines attributes and behaviours (methods) of objects in that class
Instantiation
process of making an instance of an object using the class definition - object is assigned to a reference variable (a memory location for the object)
Constructor
sets initial values of attributes as default values, random values, or values passed in as arguments
Encapsulation
binds together attributes (data) and methods (functions and procedures) that manipulate the data so that data is protected
Inheritance
allows you to create a new child class that inherits the attributes and methods of the original (parent) class
Polymorphism
ability of the system to process objects differently depending on their data type or class
Overriding
inherited methods can be overridden to change their functionality and make the behaviour more appropriate to the subclass
Association
a relation between two separate classes established through their objects
Aggregation
defines a one-way relationship that specifies a ‘has-a’ relationship between two classes - hollow diamond shape
Composition
Stricter form of association - if container is destroyed, every instance of contained class is also destroyed
“Favour composition over inheritance”
composition generally considered preferable to inheritance - composition allows greater flexibility and has less rigid relationship between two objects than inheritance
Public access modifier
defined type/member can by accessed by code within any class
Private access modifier
defined type/member can only be accessed by the code in the same class