Objects and Classes - Types - Class Versus Datatype

3 important questions on Objects and Classes - Types - Class Versus Datatype

Sometimes, there is confusion about whether something is a class or a dataType. They are both types, but they do behave differently.

What is the major difference?


The major difference being IDENTITY.
Report

How do we know that it is a class?

Imagine having two identical books, with all their attributes being the same; we would still say that we have two books. This one, and that one.

We say that objects/class instances have their own inherent identity.


If we had the two identical books and compared them, we would still say that they are different books


Report

How do we know it is a dataType?

With dataTypes, the identity resides (zit /woont?)  in the value.


Two copyright years with the same value are the same, because their values are the same.


If we compare two identical copyright years, we would say they are the same year.



Two items with the same cost have identical costs, but the changing one of the costs does not change the other cost.

Their identity was contingent (toevallig) and not inherent.
Report

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart