which PL serves as the originator of OO programming
SIMULA 67
3 benefits of inheritance
what is a derived class?
the class defined using inheritance (subclass is not entirely accurate)
what is a parent class?
the class being inherited from (superclass isn’t entirely accurate)
what is a message protocol or message interface
the entire collection of methods of an object
message passing vs subroutine call
message passing implies a request to an object to execute one of its methods that partially entails operating on the object itself
subroutines typically process data sent by the caller
class variables/methods vs instance variables/methods
class variables/methods only have one copy per class and are shared by all instance of the class
instance variables/methods have one copy for each instance of the class and are only used by the instance to which they belong
1 disadvantage of inheritance
creates interdependencies among classes that complicate maintenance
what is dynamic dispatch?
the dynamic binding of messages to method definitions. AKA the messages are statically coded but the receiving object is determined at runtime.
This creates polymorphism of sorts
What is the way in which dynamic dispatch is most often implemented?
through abstract methods (pure virtual methods in C++)
8 design issues for OO PLs
What does “exclusivity of objects” mean
it refers to how objects are used in the PL and what kinds of data are represented by objects
3 approaches to the exclusivity of objects
1 advantage and 1 disadvantage to everything as an object exclusivity approach
Adv: elegance and purity
dis: slow operations on simple objects
1 advantage and 1 disadvantage of adding objects to complete typing system exclusivity approach
adv: fast operations on simple objects
dis: results in a confusing type system
1 advantage and 1 disadvantage of an imperative style system for primitives and objects for everything else exclusivity approach
adv: fast operations on simple objects and relatively small typing system
dis: still some confusion because of two type systems
4 things that must hold for a derived class to be a subtype
What must be done to allow overridden method to be type checked statically
must have the same parameter types and return type
2 design issues with multiple inheritance
2 advantages of allocating objects on the heap?
What is object slicing?
some information is lost about an object that is allocated on the stack
this occurs when an object on the stack adds a data field and then a child class is assigned as a reference to its base and that data is no longer reachable
What is the purpose of a nested class
allows information to be hidden in one class and be visible to another (nested) class
-kind of equivalent to friends in C++
2 design issues of nested classes
3 design issues with object initialization