[Solved] Relations: Links Versus Subclasses

30 $

File Name: Relations:_Links_Versus_Subclasses.zip
File Size: 320.28 KB

SKU: [Solved] Relations: Links Versus Subclasses Category: Tag:

Or Upload Your Assignment Here:


The basis of object-oriented design and programming is the class. The power of this approach comes from class relations or associations. These are ways in which classes can interact with one another. The two most important relations are inheritance and links.

Inheritance means that one class is a subset of another class. For example, the program developed in the Benchmarks could have the Employee class be a child-class of a Person class. A child-class inherits directly from the parent-class. A subclass structure is one in which a class will inherit from every class above it in the hierarchy. The Person class might store name, birthdate, address, and other similar information. The Employee class would inherit all of that information as well as any methods and would also add information and methods of its own like pay rate. This would facilitate creating another child-class of Person called Customer that would also inherit everything from Person but would be distinct from Employee. The Discussion prompt described the possibility of making PaidEmployee and Intern subclasses of Employee. Inheritance is shown in a class diagram with an open arrow pointing from the child-class to the parent-class.

Links mean that one class can pull information or methods from another class or that another relationship exists. As an example, a Payroll class might need to call the calculate_pay method for the PaidEmployee class. As another example, there might be a separate Department class, and the Employee class would have a “works in” relationship with the Department class. Links are shown as either a single line or as a line with diamonds on one or both ends. The form and labeling of links helps to tell about the relationship between the classes. You will utilize these forms in later systems courses, but for now, just placing a line in the diagram with a brief description describing the link is fine.

Our example results in the following class diagram. This diagram was created in Visio, which is one of several tools useful for creating UML diagrams. Note that not all aspects of this class UML diagram are completed. In some cases, not all class information is included. This shows examples of inheritance and linking but does not show the full system which will have far greater complexity.

  • Using one of the information systems examples explored in previous weeks or another example of your own choosing, describe an inheritance relation between two classes and show this with a class and subclass in a diagram.
  • Using one of the information systems examples explored in previous weeks or another example of your own choosing, describe a link relation between two classes and show this with a class diagram link. It is not necessary to utilize the same system as for inheritance.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Relations: Links Versus Subclasses
30 $