educative.io

Educative

What is the difference between datatype and class?

I searched the UML document but could not understand what is the difference between datatype and class. Why here in this question, “Person” and “Address” are called datatypes and not normal classes?

1 Like

Classes are sometimes called user-defined datatypes. They are similar to datatypes. The difference lies in that an instance of a data type is identified only by its value whereas a class has attributes and associated functions. So, the terms datatype and classes are sometimes interchangeably used to refer to a type of an object instance.