CS 2110 Lecture Notes - Lecture 4: Local Variable, Class Variable

67 views3 pages
14 Jun 2017
Course
Professor

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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents