Jump to content

Object slicing

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by TakuyaMurata (talk | contribs) at 04:24, 18 March 2003 (stub). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

In computer science, slicing is an operation to slice off a target value by size of the base type, thus extra parts will be gone.

For example, in C++

class A {

 int age;
 String name;

};

class B : public A {

 bool is_male;

};

B b; A a; a = b; // slicing occurs.