
On Sat, 2011-02-26 at 14:22 +0300, Miguel Mitrofanov wrote:
Well, this code in C++ would probably work too:
Klass *k = new Klass(4,5); delete k; std::cout << k->getY() << std::endl;
though smart compiler would probably issue a warning. See, when you delete something, C++ doesn't automagically mark your pointer as "invalid"; in fact, it preserves all the data in your deleted class. If you didn't provide a destructor, then the only outcome of "delete" would be that the same memory can be assigned to another object by "new" operator, but it doesn't get cleared or invalidated in any way.
Seems to me, Haskell works in the same way.
It is implementation defined (so not "C++" but "