Top "Object-slicing" questions

Object slicing refers to assignment by value of a sub-class instance to a super-class instance,thereby losing part of the information i.e. the sub-class specific data members are ignored.

What is object slicing?

Someone mentioned it in the IRC as the slicing problem.

c++ inheritance c++-faq object-slicing
Selecting last n columns and excluding last n columns in dataframe

How do I: Select last 3 columns in a dataframe and create a new dataframe? I tried: y = dataframe.iloc[:,-3:] …

python pandas indexing dataframe object-slicing
Store derived class objects in base class variables

I would like to store instances of several classes in a vector. Since all classes inherit from the same base …

c++ polymorphism object-slicing
difference between a pointer and reference parameter?

Are these the same: int foo(bar* p) { return p->someInt(); } and int foo(bar& r) { return r.…

c++ pointers reference object-slicing
overriding virtual function return type differs and is not covariant

Ah, SO came back just in time. I am getting a strange error: 'B::blah': overriding virtual function return type …

c++ covariance virtual-functions return-type object-slicing
Is it safe to downcast objects (not pointers) to their known derived type?

Would there be a danger of slicing result Compare(const Osp::Base::Object &obj1, const Osp::Base::Object &…

c++ downcast object-slicing