Inheritance Slicing: The Top Pitfall for C++-Python Polymorphism

Inheritance slicing occurs when a derived C++ object is implicitly converted to a base class object by value, losing all derived-specific data and methods. This is a critical issue for `pybind11` as it breaks polymorphic behavior and can lead to incorrect function calls or even segmentation faults when Python interacts with C++ hierarchies.

Sources

Open the full topic