CS 4448 - Fall 1998
Object-Oriented Programming and Design
Lecture 11
Chapter 9 Inheritance
- This should just be a review but a few interesting things.....
- Commonality - Base class captures common information and features.
- Customize the existing class.
- Common Design Interface with varying implementations.
- Object Construction - Reserve all the memory for base and derived
class. The constructor to init. first base then derived. Derived class
might depend on the base class so it needs to be initialized.
- Object Destruction - Reverse of Construction for same reasons.
See Virtual Base example.
- Feature Mapping is a design issue. Don't put things that don't
make sense in a class. P. 285
- Data Conversion - What is legal and why?
Virtual Base and Multiple Inheritance
- Show multiple inheritance with and without virtual base
- Casting. What can and can not be done.
- Abstract Base Class - has a pure virtual so no instance can be created
Design Stages
- Analysis of the problem, conceptualize the design,
build, test, reanalyze and evaluate the design/system.
Chapter 10 - Polymorphism
- Operate and manipulate different derived objects in a uniform
way. Operate on different but related data types in a generic way.
- virtual functions - derived class redefines base class method
- pure virtual functions - base provides the interface but can not
implement a general solution/implementation. Related to design issues.
- v-table - virtual-table used for dynamic binding to methods
- const of P308 what does it mean, init example
Adam Jonathan Griff,
computer@griffmonster.com
Copyright © University of Colorado. All rights reserved.
Revised: November 8, 1998