CS 2110 Lecture Notes - Lecture 4: Local Variable, Class Variable
Document Summary
Lecture 4 - class hierarchy: review - big ideas. Type: a set of values and operations on them (l1) (int: +, -, *, /, %, etc. ) Classes define new types (l2: a note on method specifications. Because you might have different ways of constructing new instances of the class that don"t use certain fields. So for gethour(), if we construct the class using only minutes, then there is no hour field: today: class w (for worker) Public w(string n, int s, w b) Constructor with name n, ssn s, boss b. It by default returns the id stored in our object. Ex: w prez = new w( martinez , 123456789, null); Prez. tostring() returns the id of the object stored in prez! But if we haven"t implemented a method tostring(), how could this be possible! No matter our class, the class object is a superclass for all of them, the superest class. Has some default methods, like tostring() o.