CMSC 202 Computer Science II, Fall 2015, Section 06
Lecture 15: Inheritance
Tue 10/20, 2015
[Up]
[Previous Lecture]
[Next Lecture]
Assigned Reading: 14.1-14.2
Slides As Shown:
Topics Covered:
- Project 3.
- Class derivation and inheritance:
we discussed how C++ handles compatibility between
derived class objects and base class objects.
Programs Shown:
- Box class:
Box.h,
Box.cpp,
boxtest.cpp
and
boxtest.txt.
- Cube class:
Cube.h,
Cube.cpp,
cubetest.cpp,
and
cubetest.txt.
- Color cube class:
ColorCube.h,
ColorCube.cpp,
-
Simple use of ColorCube, showing order of construction, destruction,
and use of base class methods.
cctest.cpp,
cctest.txt.
-
Passing a derived object to a function with base class reference parameters.
cctest2.cpp,
cctest2.txt.
-
Passing a derived object to a function with base class value parameters.
cctest3.cpp,
cctest3.txt.
-
Same as cctest3.cpp, but bar3() is compiled separately.
ccsep4.cpp,
cctest4.cpp,
cctest4.txt.
-
Checking out how assignment works, or doesn't.
cctest5.cpp,
cctest5.txt.
-
Checking out pointers and dereferencing.
cctest6.cpp,
cctest6.txt.
-
C++ lets you do BAAAAD things with arrays of objects.
cctest7.cpp,
cctest7.txt.
-
Checking out function overloading and inheritance.
cctest8.cpp,
cctest8.txt.
[UMBC] |
[CSEE] |
[CMSC202] |
[CMSC202-06]
Last Modified:
22 Jul 2024 11:28:36 EDT