3 ms·
You can do this with all nominal types too. Imagine types Parent and Child. Child has more properties, yet satisfies the contract of Parent. If you enumerate
by recursive 3y ago
You can do this with all nominal types too. Imagine types Parent and Child. Child has more properties, yet satisfies the contract of Parent. If you enumerate all the properties of some arbitrary Parent p, you may get some extra properties.
- _ZeD_ 3y agothat's not how nominal types work: the properties looped over will be only the one of Parent
- bazoom42 3y agoIn Java or C# you would need to use reflection to loop over the members of an object, but AFAIK this would yield the members of the current instance, not the nominal type.
- recursive 3y agoNo, sorry, you're not right. Here's some C# you can run in your browser. https://dotnetfiddle.net/ZeSNkA https://dotnetfiddle.net/ZeSNkA