Explain objects and tuples more extensively

This commit is contained in:
twetzel59 2017-12-27 20:59:45 -05:00
parent caa3674954
commit a1216d18b7
1 changed files with 1 additions and 1 deletions

View File

@ -108,7 +108,7 @@ It is possible to implement object-orientation features from other languages (li
### Structs - Tuples and Objects
Tuples and Objects in Nim are kind of like structs in C, but not really.
Tuples and Objects in Nim are kind of like structs in C, but not really. Objects, like C structs, use nominal typing. This means that given objects A and B (where B is not a subclass of A), A can not be substituted for B, and B can not be substituted for A, even if they have the same fields. Tuples, on the other hand, use structural typing. If a tuple C contains the same fields as tuple D, they are interchangeable. This is a feature not present in C.
### Interfacing C and Nim