CS 330 Lecture 28 – Inheritance and polymorphism
- fixing our stack?
- is-a vs. has-a
- inheritance tightly couples, destroys encapsulation
- modern thinking: limit inheritance, favor shallow hierarchies and has-a composition
- when inheritance is a good idea
- when refactoring a library you maintain
- when writing a GUI widget
- polymorphism: lets you write conductor code
- easy in dynamically-typed languages
- in statically-typed, polymorphism achieved via:
- coding to a supertype
- C++ favors static method binding over dynamic binding
How would you view this sort of grading?
|Number of Programs
With these restrictions:
- Students could choose from a broad set of programming assignments.
- One program must be from the imperative category.
- One program must be from the scripting language category.
- One program must be from the functional category.
- One program must be from the interpreters category.
- No more than one program may be turned in each week.
- All programs must be turned in before the last week of lecture.
- Programs that do not meet criteria will be returned for correction.
Grades would be easy.
But you all have vtables.
You are dynamic.