Tutorials : UML modeling for information system architecture : Module 3: Create class diagrams : Lesson 3.5: Create inheritance relationships
  
Lesson 3.5: Create inheritance relationships
Build a straight, any orientation line to illustrate the options of a customer making a reservation on business.
In the hotel system, you have various types of customers. In the beginning of this tutorial, you analyzed the problems of the business. It is stated that you would be concentrating on business travelers and vacationers. These two classes of customer will have different behaviors so you may want to introduce them into your design as separate classes that inherit from the basic Customer class.
For example, although a Business Traveler has a name, address, telephone number, fax number, and credit card number that a standard customer has, the business traveler also has a corporate discount, and can be guaranteed a room if their company is involved in hosting a conference in the hotel or at an affiliated conference hall. Similarly, a vacationer can partake in vacation package discounts.
Note System Architect offers a number of line styles to select when drawing a line. You have been using the Straight - Orthogonal choice. You can now switch to Straight - Any Orientation.
To model the subclasses Business Traveler and Vacationer on the class diagram
1 Select Format > Symbol Format > Line.
2 In the Line Style dialog, toggle Straight - any orientation and click OK to close the dialog.
3 Select the Class tool from the toolbar and add a new class to the diagram, placing it under the Customer class. Name it Business_Traveler.
4 Select the Inherits From line from the toolbar and draw an inheritance relationship from Business_Traveler to Customer.
5 Draw a second class on the diagram, placing it under Customer, and name it Vacationer.
6 Select the Inherits From line from the toolbar and draw an inheritance relationship from Vacationer to Customer.
The existing attributes and methods for Customer do not need to be repeated in the class Business_Traveler or Vacationer. The inheritance line semantically specifies that these 'subclasses' inherit all attributes and methods of the 'parent' class, plus have their own attributes and methods.
7 Open the definition dialog for Business_Traveler (double-click the symbol or right click it and select Edit), select the Attributes tab and type in Corporate_Discount as a new attribute. In the Type column, select char. Click OK to close the dialog.
8 Open the definition dialog for Vacationer, select the Attributes tab and type in Vacation_Package as a new attribute. In the Type column, select char. Click OK to close the dialog.
Building a Second Inheritance Structure
Now take a look at the Reception class. This is a class that will interface with the end user, or Customer. In this system, Reception can well be a Receptionist that answers the phone at the front desk of a hotel, or at the Hotel's call center at its 1-800 number. Or, it could be a Reservation Order form on the hotel's website. These various forms of reception should be modeled with different classes, since their behavior and capabilities can be different, although they perform the same basic functions, to interface and get information from the customer.
1 Select the class tool from the toolbar and add a new class to the diagram, placing it under Reception. Name it Reservation_Form.
2 Select the Inherits From line from the toolbar and draw an inheritance relationship from Reservation_Form to Reception.
3 Draw a second class on the diagram, also placing it under Reception. Name it Receptionist.
4 Select the Inherits From line from the toolbar and draw an inheritance relationship from Receptionist to Reception.
Completed Class Diagram
You have completed your first-cut class diagram.
5 Select File > Save Diagram to save the class diagram.