CS 330 Lecture 28 – Inheritance and polymorphism
Agenda
- fixing our stack?
- oop:
- encapsulation
- polymorphism
- inheritance
- 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:
- overloading
- templates
- coding to a supertype
- C++ favors static method binding over dynamic binding
Achievement-based Grading
How would you view this sort of grading?
Number of Programs | Without final | With final | With participation |
---|---|---|---|
6 | B | A- | A |
5 | C | B | B+ |
4 | D | C | C+ |
3 | F | D | D |
<= 2 | F | F | F |
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.
Code
…
Haiku
Grades would be easy.
But you all have vtables.
You are dynamic.
But you all have vtables.
You are dynamic.