1. Swappable base class, unswappable derived class, undefined behaviour?
2. Why is delete[] basePtr undefined if basePtr points to array of derived-class objects
class B
{
virtual ~B();
}
class D:public B
{
virtual ~D();
}
B *b = new D[5];
delete[] b;
Why is the above undefined.
Is this compiler dependent then?
I can safely compile and run this code in VC and the destructors are
called in sequence.
3. Linker: 'undefined references' using derived class
4. function defined with base class return derived class object when called with a derived class
5. function defined with base class return derived class object when called with a derived class
6. function defined with base class return derived class object when called with a derived class
7. function defined with base class return derived class object when called with a derived class
8. function defined with base class return derived class object when called with a derived class