TITLE: Pointers, arrays, and problems PROBLEM: C++ has a very large hole concerning type safety regarding pointers and arrays. RESPONSE: Taken from class notes on Adv C++ by Desmond Dsouza class A { public: int av; }; class B : public A { public: int bv; }; void f (A* x) { x[1].av = 0; } main () { B y [100]; y [0].bv = 1; f (y); // One of the B in the array has just been stomped on. // This assertion will fail. assert (y [0].bv == 1); } Never write methods that accept (manipulate) arrays of objects of types that may be subclasses. Someday they will fail!