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?
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?
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.
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