CS 1130: Transition to OO Programming
Module 2, Part 2
More on OO Programming
In this part, we discuss a bunch of object-oriented concepts in Java.
1. Static ComponentsWeb Lecture
Comments: Only one copy of a static variable or method exists, and it resides in the class file drawer.
2. The Bottom-Up Rule
The bottom-up rule (also called the method-overriding rule)
3. The Inside-Out RuleWeb Lecture
Comments: >Within a construct one can reference variables and methods declared in that construct and in surrounding constructs.
4. The Class InvariantWeb Lecture
Comments: The set of constraints given in the documentation of the fields of a class constitute the class invariant. We show why you should be careful in writing and using it.
5. Calling Constructors from ConstructorsWeb Lecture
Comments: Within a constructor, one can call a constructor in the same class or in the superclass. Such a call must be the first statement of the constructor body.
6. The Default ConstructorWeb Lecture
If you do not declare a constructor in a class
7. Casting About
Gries/Gries, Sec. 4.2, pp. 148–153
We extend the notion of narrower and wider types to class types and show the consequences thereof.
We also introduce operator
8. Apparent and Real ClassesWeb Lecture
Comments: The apparent class of a variable is a syntactic property; its real class is a semantic property. We show how each is used.