n ; return _x ; } void all_funcs_y ( y _y ) { all_funcs_x ( y_cast_x ( _y )); } In practice, a C++ compiler will organize the fields so that y_cast_x is free when used with references or pointers.
// Example 3 struct x { int n ; virtual void f (); virtual void g (); virtual void h (); }; void all_funcs_x ( x _x ) { _x.