Riel, Sections 5.1-5.6
Discussion Questions submitted for Sections 5.1-5.6 of Riel
Inheritance, Specialization, Generalization, and Containment
One-phrase Definitions:
Inheritance: or public inheritance: a subclass becomes a
subtype of a superclass or base class
Specialization: one item is a special case of another
Generalization: identification of one or more common elements
(data, operations) among several classes
Containment: an object or class is a component of another.
-
What are the differences between generalization and specialization? --Khong
-
What are the advantages of inheritance over containment? (Sam Vanderhyden)
-
Can you clarify the difference between inheritance and containment
relationships?
-
An real world example of Heuristic 5.1 will nice. - George
-
Can you give a less abstract example of heutistic 5.1? Anthony
-
Can you better distinguish how inheritance can be both a generalization and
a specialization? - Jim Finnessy
-
Is it really true that in all cases base classes should have no knowledge
of derived classes? Is reusability the major reason for this? Patrick Dowd
-
Can you clarify the ambiguity among superclasses and subclasses? - Jim
Finnessy
-
It seems that a white-box design and heuristic 5.2 contradict each
other. Could you please explain the difference between those? --Hisako
-
Does heuristic stating that inheritance should only be used to model a
specialization hierarchy mean that you should avoid generalization-style
inheritance? (-Nick W.)
Public, Protected, and Private Data
-
What properties of public and private access areas does the protected
access area contain? ~yasir.
-
Can you discuss private/public data a bit more? -Kensler
-
Please axplain the concept of protected data and methods of a class?
Anthony
-
Could you explain in a bit more detail the difference between public,
private, and protected data, and when each is appropriate?
-
Why does heuristic 5.3 limit its scope to only base classes? i.e. why should
data ever be protected or public? Steve F
-
Is it really never ever good to have protected data? Dessislava Dimova
-
I am still confused about why we should use private data with protected
accessibility instead of just protected data in a base class. Could you
explain more on this? (Raz Magar)
Width and Depth of Inheritance Hierarchies
-
Why have heuristic 5.4 if it is immediately qualified by 5.5? Why not only
have 5.5? -Peter Likarish
-
What are the merits and demerits of Heuristic 5.4? - George
-
Can you give more detail on what is meant by deep in Heur. 5.4? -Kensler
-
Why is it better to have deep inheritance hierarchies? Don't they just
contribute to overall complexity? (Sam Vanderhyden)
-
In what kind of design would generalization hierarchy be applicable? (Raz
Magar)
-
Heuristic 5.4: why is this good? Why can't we have a class with all the
abstractions? - Elias Vafiadis
-
Could you explain the distinction in different types of inheritance using
C++ illustrated on pg. 87? -Peter Likarish
-
could you differentiate between deep hierarchies and specialization
hierarchies. taha
-
I found the comment on the bottom of page 84, about how a graphical tool
could invalidate heuristic 5.5, particularly striking. Isn't it true that
graphical computer-generated views could invalidate many of the heuristics
we have seen concerning boundaries designers should operate in? Todd
Public, Protected, and Private Inheritance in C++
-
Riel advises not to use private and protected inheritance in C++. Is it
still good idea to use these implemented relationships for containment
purposes? Dessislava Dimova
-
Can you clarify the difference between public inheritance and protected
inheritance?
-
could you give examples of the correct use of protected, private and public
inheritance. taha
-
Why does C++ allow you to use private or protected inheritance? Does Java
as well? Steve F
-
If protected data should not be used, then why does the author consider
languages with no provision for protected data inferior to those that have
it? Patrick Dowd
Method Overriding
-
To what is Riel referring when on p. 79 he states that "most
object-oriented languages support the calling of the base class method from
an overriding derived method"? How exactly does this work? (-Nick W.)
-
What exactly is the overriding method? The user can add a specialization
relationship that is not behaviorally compatible to the superclass; can the
user completely change or delete a message of the superclass? - Elias
Vafiadis
-
Are there any disadvantages of allowing overriding? ~yasir.
Miscellaneous Problems
-
the C++ inheritance setup seems complex, is this something that needs to be
known?
,li>
Could we get more explanation of the types of inheritance in Java and C++?
Todd
-
What are the differences between public section of a class and public
interface of a class? Why does one want to separate accessibility for each
of those? --Hisako
-
How can we illustrate the differences between a black-box design and a
white-box design? --Khong
-
How should you handle cases where a class can logically inherit from more
than one base class?
-
what is the usefulness limit to abstract classes as base classes?
This document is available on the World Wide Web as
http://www.cs.grinnell.edu/~walker/courses/223.sp02/read-riel-5a.html