A
has a component that is an object of
class B
, then the HAS_A relation holds from class A
to class B
.
Car
has an Engine
.
Car
to class Engine
.
A
object HAS_A class B
component, then an
object of class B
should be a data member of class
A
.
A
is an object of a more general class
B
, then the IS_A relation holds from class A
to
class B
.
Car
is a Vehicle
.
Car
to class
Vehicle
.
A
object IS_A class B
object, then class
A
should be derived as a subclass of class B
.
FordMustang
IS_A Car
and a Car
IS_A Vehicle
, then a FordMustang
IS_A
Vehicle
.
B
is a subclass of class A
and class
C
is a subclass of class B
, then class C
is a subclass of class A
.
C
inherits data members and member functions from classes
A
and B
.
person.h
(original),
person.h
(copy), man.h
(original),
man.h
(copy), woman.h
(original),
woman.h
(copy), father.h
(original),
father.h
(copy), mother.h
(original),
mother.h
(copy), marriedman.h
(original),
marriedman.h
(copy), marriedwoman.h
(original),
marriedwoman.h
(copy), This page was last modified on Mar 1, 2001
URL: http://people.hsc.edu/faculty-staff/robbk/Coms262/Lectures/Inheritance.html