Page 312 -
P. 312

chaPter 10  •  object-oriented systems analysis and design Using Uml     279

                 of the same method with the same name within a superclass/subclass relationship. The subclass
                 inherits a parent method but may add to it or modify it. The subclass may change the type of
                 data, or change how the method works. For example, there might be a customer who receives
                 an additional volume discount, and the method for calculating an order total is modified. The
                 subclass method is said to override the superclass method.
                     When attributes or methods are defined more than once, the most specific one (the lowest
                 in the class hierarchy) is used. The compiled program walks up the chain of classes, looking for
                 methods.
                 aBstraCt ClassEs.  Abstract classes are general classes and are used when gen/spec is included
                 in the design. The general class becomes the abstract class. The abstract class has no direct
                 objects or class instances, and is only used in conjunction with specialized classes. Abstract
                 classes usually have attributes and may have a few methods.
                     Figure 10.20 is an example of a gen/spec class diagram. The arrow points to the general
                 class, or superclass. Often the lines connecting two or more subclasses to a superclass are joined
                 using one arrow pointing to the superclass, but these could be shown as separate arrows as well.
                 Notice that the top level is Person, representing any person. The attributes describe qualities that
                 all people at a university have. The methods allow the class to change the name and the address
                 (including telephone and email address). This is an abstract class, with no instances.
                     Student and Employee are subclasses because they have different attributes and methods.
                 An employee does not have a grade point average and a student does not have a salary. This is a




                                               Person                                           Figure 10.20
                                        –lastName                                               A gen/spec diagram is a refined
                                        –firstName                                               form of a class diagram.
                                        –street
                                        –apartment
                                        –city
                                        –state
                                        –zip
                                        –telephone
                                        –cellPhone
                                        –email
                                        +changeAddress( )
                                        +changeName( )
                                canbea                        canbea
                                  isa                          isa

                             Student                            Employee
                       –studentNumber                     –employeeNumber
                       –creditsCompleted                  –salary
                       –gradePointAverage                 –YTDGross
                       –department                        –YTDWithholding
                       –major                             –dateHired
                       –minor                             –department
                       +changeStudent( )                  +changeEmployee( )
                       +findStudent( )                     +printTaxInformation( )
                       +graduateStudent( )                +producePaycheck( )
                       +initialize( )
                       +studentComplete( )            canbea               canbea
                       +viewStudent( )
                                                        isa                isakinda

                                                   Faculty                  Administrator
                                            –degree                     –title
                                            –position                   +changeEmployee( )
                                            –webURL
                                            +changePosition( )
                                            +changeURL( )
   307   308   309   310   311   312   313   314   315   316   317