- Classes encapsulate methods which encapsulate procedures
- These ‘modules’ can be used in different programs without having to understand how they’ve been implemented
- Def: names (of variables and methods) are stored in locations that then have to be accessed, called namespaces or environments.
- When we create a subclass, we want it to inherit a lot of behaviors of the parent class. For example, when we have classes ‘Student’ and ‘Parent’ (the first being a child class of the latter), we would expect students to behave as people for any piece of code. In other words, we want the subclass to be able to be used in any context. This saves saves us from having to rewrite code for particular behaviors of different subclasses.
- Def: Any procedure or method with a yield statement
- see example code for explanation: http://codepad.org/MQQYZS2j
- Def: The ability to define a new class as a modified version of an existing class
- The new class (i.e. subclass or ‘child’ class) inherits the methods of the existing (i.e. ‘parent’ or super class); however, if the subclass uses the same name for a function which has also been used in the superclass, it will only use the subclass definition of that function.
Abstract data type:
- Def: A set of objects and the operations on those objects.
- ADT are purely theoretical entities that are defined indirectly, only by the operations that may be performed on it and by mathematical constraints on the effects/cost of those operations
- Used to simplify the description of abstract algorithms, to classify and evaluate data structures
- May be implemented in many ways and in many programming languages