Algorithms and OOD (CSC 207 2014S) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions] [GNU Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013F (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)] [Issue Tracker (Textbook)]
Overview
Why use interfaces when I can just use inheritance?
What if you want to support two different interfaces?
Images are renderable
Images are multipliable
And multiple inheritance is really confusing. What if both superclasses have a method with the same signature? (implementing multiple inheritance is also a PITN)
Arrays are probably Iterable, Clonable, and Comparable
There's not much data or methodology you'd want to inherit
If my class extends a class that implements multiple interfaces, does my class also implement those interfaaces?
Yes, and you don't even need to say so explicitly. (I hope.)
How do I use inheritance in place of interfaces?
We've seen that if A implements B then we can use A in place of B.
It's also the case that if A extends B then we can use A in place of B.
What are the big differences between inheritance and implementation?
In inheritance, you get copies of the fields and methods.
In inheritance, you need to be careful in the design of your constructors (see lab for details)
Thinking about ways to group blocks
TextBlock block1 = new TextBlock("Hello");
BoxedBlock block2 = new BoxedBlock(block1);
vs.
TextBlock block1 = new TextBlock("Hello");
TextBlock block2 = new BoxedBlock(block1);
vs.
TextBlock block2 = new BoxedBlock(new TextBlock("Hello"));
Problem 7
width? height?
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions] [GNU Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013F (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)] [Issue Tracker (Textbook)]
Copyright (c) 2013-14 Samuel A. Rebelsky.

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.