nomicon
nomicon copied to clipboard
canonical example introducing subtyping
The example trying to show a problem copying a dog's data into an animal's slot is not convincing me of any problem: only the animal part of the dog is going to be copied and that's presumably compatible with a cat's data. It's called slicing in C++. AFAICT a direct transcription of the code to C++ would work fine.