3 ms·
I think the Scala version does exactly what you want it to do, but you seem to be confused about something that I can't really pin-point. > Why do I need a sep
by simon_o 9y ago
I think the Scala version does exactly what you want it to do, but you seem to be confused about something that I can't really pin-point.
> Why do I need a separate Person and Dog class?
You don't. It's an example.
> Can't a dog have a name as well?
It can.
> Why do I need to declare that upfront or ensure that no other part of code can give a Dog a name?
I have trouble understanding the meaning of that sentence.