4 ms·
> You can rip off a chunk of an object by accident... and nothing happens whatsoever. There's no warning from the compiler. Slicing is a bad name for this phen
by slavik81 5y ago
> You can rip off a chunk of an object by accident... and nothing happens whatsoever. There's no warning from the compiler.
Slicing is a bad name for this phenomenon, because what you've described is what the name implies, but that is not what is happening. The original object is completely unchanged. Nothing was ripped off of it. Constructors create new objects.
- gpderetta 5y agoI think slicing gets a bad name because of the old pervasive OOP mentality. Slicing is perfectly fine and expected in a value-type oriented program.