Explain objects and tuples more extensively
This commit is contained in:
parent
caa3674954
commit
a1216d18b7
|
@ -108,7 +108,7 @@ It is possible to implement object-orientation features from other languages (li
|
||||||
|
|
||||||
### Structs - Tuples and Objects
|
### 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
|
### Interfacing C and Nim
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue