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

Popular posts from this blog

minify - Minimizing css files -

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -