Databases Reference
In-Depth Information
PRODUCT
Product Number
Product Name
Unit Price
TOOL
Weight
LIGHT FIXTURE
Number of Bulbs
Watts per Bulb
LUMBER
Type of Wood
Dimensions
POWER TOOL
Amperes
NONPOWER TOOL
Years of Warranty
FIGURE9.2
General Hardware Company product
generalization diagram
are tools. But now, General Hardware has decided to expand its product line beyond
tools to include light fixtures and lumber. Figure 9.2 shows a generalization diagram
that represents General Hardware's expanded product line and recognizes that while
all of the products share some common attributes, different kinds of products have
additional unique attributes. Each box in Figure 9.2 represents a class and has three
sections separated by horizontal lines. At the top, in capital letters, is the class
name. In the middle are the class attributes. At the bottom are the class operations
(although we're not showing any operations yet). The upward-pointing arrows
indicate generalizations. The diagram shows that there are three kinds of products:
TOOLs, LIGHT FIXTUREs, and LUMBER. Furthermore, there are two kinds of
tools: POWER TOOLs and NON-POWER TOOLs.
Inheritance of Attributes
The PRODUCT class indicates that all products have three common attributes:
Product Number, Product Name, and Unit Price. In fact, we say that all of the
classes below PRODUCT inherit the attributes shown in PRODUCT; that is,
they include these attributes among their own. In general, attributes are inherited
downwards in these generalization diagrams. So,
the attributes for POWER TOOLs are Product Number, Product Name, Unit
Price (all from PRODUCT), Weight (from TOOL), and Amperes.
Search WWH ::




Custom Search