Exam4Training

What is the key difference between DataTypes and Classes?

What is the key difference between DataTypes and Classes?
A . Classes can have operations that show that a class reacts to invocations sent by other classes DataTypes do not have this feature.
B . DataTypes can only be very simple structures with attributes that are Datatypes as well, whereas Classes can be of arbitrary complexity.
C . Two instances of a Datatype are considered to be equal when all their attributes have the same values, unlike instances of classes.
D . Classes can inherit attributes, operations and other features of their super classes. DataTypes can only get instantiated.

Answer: C

Explanation:

DataTypes in UML are a type of classifier that represents a set of values that do not have identity, which means that two instances of a DataType are indistinguishable if all their attributes are equal. This is in contrast to instances of Classes, which are distinguishable by their identity – each instance is considered unique even if their attributes have the same values.

Option A is incorrect because DataTypes can indeed have operations in UML.

Option B is also incorrect; DataTypes can have attributes of any complexity.

Option D is incorrect because DataTypes can also have features inherited from their super DataTypes; it is not solely about instantiation.

The UML 2.5 specification discusses DataTypes in section 10.5.8, stating that DataTypes do not have an identity and are often used to type attributes and operation parameters. The equality of DataType instances is based on the equality of their attribute values. Classes, however, are described in section 9.2 of the UML 2.5 specification as elements that can have identity, and instances of a Class are distinguished based on that identity.

Exit mobile version