//  (C) Porkolab 2003
//
//  A.5.9.
//   
//  Arrays are not polymorphic
//

#include <iostream>

using namespace std;

struct Base
{
    Base() { cout << "Base" << " "; }
    virtual ~Base() { cout << "~Base" << endl; }
    int i;
};
struct Der : public Base
{
    Der() { cout << "Der" << endl; }
    virtual ~Der() { cout << "~Der" << " "; }
    int it[10];     // !! if the derived bigger than base...
};

int main()
{
    Base *bp = new Der;
    Base *bq = new Der[5];

    delete    bp;
    delete [] bq;
}

// ...this code likely cause run-time error