Answer
Object slicing occurs when a derived object is copied into a base object by value. • Only the base subobject is copied into the destination. • Derived members and derived dynamic type are not preserved. • Use a reference, pointer, or polymorphic clone when the full derived object must remain.
💡 C++ Example
struct Base { int base_value{}; };
struct Derived : Base { int derived_value{}; };
Derived source{{1}, 2};
Base sliced = source;
⚡ Quick Revision
Copying a derived object into a base object by value slices off the derived part.