Algorithms and OOD (CSC 207 2013F) : EBoards

CSC207.01 2013F, Class 13: Inheritance


Overview

Admin

HW4

How should we evaluate the following?

    r1 = 2/3
    1 + r1

You should give something like the following

    2/3, 5/3

What would you put in the Fraction class? (We'll do this as a group.)

Hash code implementation

* `int hashCode() { return 1; }`
* `int hashCode() { return numerator.hashCode() * denominator.hashCode(); }`

Why won't my test code work

    public void test() throws Exception {
        ...
    }

More on the text block example

    +-------+
    | Hello |
    +-------+

Inheritance basics

Lab

Sample code

public class Counter {
   int count;
   int start;

   public Counter(int i) {
       this.count = i;
       this.start = i;
   } // Counter(int)

} // class Counter

Copyright (c) 2013 Samuel A. Rebelsky.

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.