c++ - What is object slicing? -
someone mentioned in irc, google doesn't have answer.
"slicing" assign object of derived class instance of base class, thereby losing part of information - of "sliced" away.
for example,
class { int foo; }; class b : public { int bar; }; so object of type b has 2 data members, foo , bar.
then if write this:
b b; a = b; then information in b member bar lost in a.
Comments
Post a Comment