Which diagram shows inherited properties?

Which diagram shows inherited properties?

A)

B)

C)

D) Inherited properties cannot be shown In a specialized class.

A. Option A

B. Option B

C. Option C

D. Option D

Answer: B

Explanation:

In UML, inherited properties are those attributes that are defined in a superclass and inherited by a subclass. According to UML notation, when a subclass inherits from a superclass, it inherits all the attributes and operations of the superclass unless they are redefined.

Let’s examine each option:

A. In Option A, the Customer class shows the attributes name and address repeated from the Person class. This is not necessary in UML to show inheritance and could imply these are different attributes that happen to have the same name.

B. In Option B, the attributes of the Person class are not shown in the Customer class. This is correct as UML assumes that all attributes and operations are inherited by the subclass, and there is no need to repeat them unless they are overridden or extended. In this case, the diagram shows inheritance correctly without redundant representation of inherited properties.

C. In Option C, the inherited properties name and address are explicitly marked as inherited. While it’s possible to show inherited properties in this way for clarity, it’s not necessary and is less common in standard UML class diagrams.

D. Statement D is incorrect because inherited properties can be shown in a specialized class, although it is not a requirement to do so for the properties to be inherited.

Based on the UML 2 Foundation specification, the correct way to depict inheritance without redundantly listing inherited attributes is shown in Option B.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments