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.

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

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.

Try our study magic for free

a PDF, study it super fast
  • No sign up, email or credit card needed!
  • AI makes unlimited flashcards
  • Get unlimited quizzes and tests
  • Ask AI anything
Create a notebook
  • No sign up, email or credit card needed!
  • Have and keep perfect overview
  • Make flashcards, notes and mind maps
  • Review, test and score!

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