Homework 10, OO design and C++
Problem 1.
Consider a class bicycle
. Given your knowledge of some
common components of bicycles, show a class hierarchy in which the
class bicycle
inherits from other classes,
which, in turn, inherit from yet other
classes. Discuss the instantiation of various objects of class
bicycle
Discuss inheritance from
class bicycle
for other closely related derived classes.
Problem 2.
Discuss why converting from a vase-class pointer to a derived-class pointer is considered dangerous by the compiler.
(True/False) A derived-class object is also an object of that derived class's base class.
Problem 3.
Given that constructors cannot be virtual, describe a scheme for how
you might achieve a similar effect.
Problem 4.
Distinguish between inheriting interface and inheriting implementation. How do
inheritance hierarchies designed for inheriting interface differ from
those designed for inheriting implementation?
Problem 5.
Sethi problems 7.1, 7.2, 7.3.
Problem 6.
Stacks and queues can be implemented as linked lists. Designed classes
linklist
, stack
and queue
.