CMSC 202 Computer Science II, Spring 2007, Section 010x
Lecture 15: Inheritance
Thursday 03/29, 2007
Slides As Shown:
- Answered some questions about
- Continued discussion on class derivation and inheritance.
In particular, we discussed how C++ handles compatibility between
derived class objects and base class objects.
We derived a ColorCube class from the Cube class which in turn
was derived from the Box class (see
Simple use of ColorCube, showing order of construction, destruction,
and use of base class methods.
Passing a derived object to a function with base class reference parameters.
Passing a derived object to a function with base class value parameters.
Same as cctest3.cpp, but bar3() is compiled separately.
Checking out how assignment works, or doesn't.
Checking out pointers and dereferencing.
C++ lets you do BAAAAD things with arrays of objects.
Checking out function overloading and inheritance.
- Looked briefly at a Unix Graphical User Interface (GUI)
tool kit called GTKmm. This
tool kit is set up so you create customized windows using class
derivation. The "real life"
inheritance hierarchy is rather complicated.
The programs shown won't compile unless
you have gtkmm and associated libraries installed. The programs
are here, but you are much better off
looking at the GTKmm
[Spring '07 CMSC202]
30 Oct 2012 15:27:32 EDT