To represent an instance of a class in a UML Object Diagram, the standard notation is to specify the instance name followed by a colon and the class name, and then list the attribute values within the compartment.
The class definition forCompanyspecifies that there is one attribute,name, of typeString.
An instance ofCompanywhere thenameattribute has the value "OMG" would be shown as follows:
In the provided options, Option D correctly represents an instance of theCompanyclass with thenameattribute set to "OMG". The name of the instance is not specified, which is allowed in UML when the instance name is not important or is understood from the context.
Thus, the correct answer is:
D. Option D
[Reference: Object Management Group (OMG) Unified Modeling Language (UML) Specification Version 2.5.1 Section 9.6 on Instance Specification which outlines the notation for showing instances and their attribute values., ]
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit