Interfaces
So far
- Interfaaces are contracts.
- For a class to implement an interface, it must
specify
implements
in the class header.
- Interfaces are types. They can be used in function arguments and in type parameters in generic classes.
- Variables can be of interface type. Classes that implement an interface are subtypes of its type.
Delegation and Visibility
Visibility Prinicple The type of a variable determines what methods are visible.
Delegation Prinicple The execution of a method call is delegated to the object being pointed at (the pointee).
Can we create a subtype of a class?
Functional Interface A functional interface specifies exactly one method.