What is slicing in the context of object-oriented programming in C++? 

  • Removing virtual functions 
  • Copying an object's base part 
  • Increasing object size 
  • Converting to different type
Slicing in C++ refers to the situation where a derived class object is assigned to a base class object. In such cases, only the base class's portion of the derived object is copied, and the additional members of the derived class are 'sliced off'. This can lead to unintended behaviors if not carefully managed.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *