So, they are abstracted to form a superclass:
Superclass=(SIDy,CSy,CMy) (4)
Here SID is the identifier of the superclass.
After defining the Superclass, the Classy and
Classy are written:
Classy=(CIDy,CSg,CMp) (5)
Classy=(CIDy,CS¢, CMG)
Class] and Class» are called subclasses of the
Superclass.
Subclass and superclass are related by an is a
relation. For example, the class building is the
superclass of the class hotel because a hotel is
a building. A subclass may also have a further
classification. The building/hotel generalization
can be extended with the classes inn, guest house
and motel etc. While hotel is a subclass of
building, it can be at the same time a superclass
of guest house.
2.2.2 Inheritance In generalization
hierarchies, some of the properties and methods
of the subclasses depend upon the structures and
properties of the superclass(es). Inheritance is
a tool to define a class in terms of one or more,
other more general classes. Properties and
operations which are common for superclass and
the subclasses are defined only once, and the
properties and operations of the superclass are
inherited by all objects of the subclasses.
Inheritance is the transitive transmission of the
properties from one superclass to all related
subclasses, and to their subclasses, etc. But
subclasses can have additional, specific
properties and operations which are not shared by
the superclass. This concept is very powerful,
because it reduces information redundancy and
maintains integrity.
The inheritance can be single or multiple. Single
inheritance requires that each class has at most
a single immediate superclass. Figure 1 has shown
an instance of single inheritance.
building
|
residence
it
city residence| fural residencd
Fig. 1 An instance of single inheritance
In multiple inheritance, one subclass has more
than a single direct superclass, such as the
subclass hotel may have superclass building and
superclass business.
Suppose:
Class3=(CID3,CSy,CSp, CSc, CMy,CMp, CM) (6)
Here C34, CSg, CM,, CMp, are in common with two
other classes. Therefore two superclasses can be
constructed:
Superclass;-(SID, ,CS4,CMA) (7)
774
Superclassy=(SIDy,CSg,CMp)
In order to acquire all information and methods,
Classy must inherit the data and operations from
Superclass; and Superclass».
An example from geography shows how multiple
inheritance often combines two distinct
hierachies. One hierarchy is determined by the
separation of artificial and natural
transportation links, whereas the other hierarchy
distinguishes water bodies. Classes with
properties from both hierarchies are channels,
that are artificial transportation links and
water bodies, and navigable rivers, whereas ponds
belong only to one hierachy(Fig. 2)
transportation links
artificial. natural |
transportation transportation
channel
Fig. 2 An example of multiple inheritance
2.3 Association,Aggregation and Propagation
2.3.1 Association An association relates two or
more independent objects by considering the
relation among objects as a higher level set
object. For example, parcel 1 and parcel 2 all
belong to Mr. Neilbsen, they can be grouped as
Neilbsen’s parcel. Parcel 1 and parcel 2 are
called members of Neilbsen’s parcel. Suppose:
Objecty=(ID;,S4,Sp,M) (8)
Objecta=(ID9,S4,Sç,M)
A new object contains Object, and Object» :
Object3-(ID3, S4, Object; ,Objecto,M) (9)
In this case, the Object and Objecto are writen:
Object1=(IDy ,Sp,M) (10)
Objectg=(ID9,Sç,M)
Here Object] and Object, are termed component
objects. Hence, this abstraction is referred to
as the member of relation.
2.3.2 Aggregation A similar abstraction
mechanism to association is aggregation which
models composed objects. i.e., objects which
consist of several other objects. Several objects
can be combined to form a semantically higher
level of object where each part has its own
functionality. The operations and properties of
an aggregate are not compatible with those of
parts. For example, the class building is an
aggregate of all walls, doors, windows and roofs
which are parts of it.
There are two different component objects:
ot
Ot
Com
are
- I
hie
(pa
hie
- ]
fro
pro
ope
pro
pro
pro
In
rel
com]
pro;
obt:
3.1
In
poir
whic
feat
betw
vari
pror
abst
comr
besi
decl
buil
it
feat