CS 330 Lecture 28 – Inheritance and polymorphism
April 11, 2012 by Chris Johnson. Filed under
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378
Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379
Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380
Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381
Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382
Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378
Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379
Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380
Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381
Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382
Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 378
Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 379
Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 380
Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 381
Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 382
Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /var/www/twodee/blog/wp-includes/category.php on line 383
cs330, lectures, spring 2012.
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.