7.0 Classes
Note that this can introduce hard-to-find bugs whenever an explicit or implicit cast is encountered or in matching certain sets of overloaded functions.
Example:
class Item {};
class ItemA : public Item {};
class ItemB : public Item {};
class ItemAB;
class Head
{
public:
Item* first() ;
};
class HeadB : public Head
{
public:
ItemAB* first() { return (ItemAB*)(ItemB*)Head::first(); }
};
// At this point the casts above are effectively only a C-style
// reinterpretation of the pointer value.
class ItemAB : public ItemA, public ItemB {};
// Now any casts will be an inheritance conversion (adjustment of // the "this" pointer; the previous casts may have generated bad
// code!
Generated with CERN WebMaker