Lecture overview -- Keyboard shortcut: 'u'  Previous page: Inheritance: Constructors and destructors  -- Keyboard shortcut: 'p'  Next page: Member access control: private, public and protected -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Abstraction Mechanisms, Part 2 - slide 3 : 24

Inheritance: Copying and slicing
'Real object-oriented programming' relies on reference semantics (use of pointers or C++ references to objects) rather than value semantics (copying of objects)
slice-1.cc
Illustration of object slicing.
slice-1-output
Program output.
slice-2.cc
Does this variant change the game?.
slice-2-output
Program output.
Go to exercise
Slicing an object during parameter passing.