Too tired to look this up right now...

Can a base-class ptr be used to delete an object of a derived class?

for instance (CMyWnd is derived from CWnd):

CMyWnd* pMyWnd = new CMyWnd; // create derived obj on heap
CWnd* pWnd = pMyWnd; // point base class ptr to obj of derived class
delete pWnd; // delete obj of derived class

this seems to work, but is it a clean deletion? For instance, if CMyWnd has additional data items (takes up more mem) will the CWnd* deletion remove the entire CMyWnd class structure?

Thanx for any help. I have a feeling that I've actually just read the answer to this, but right now everything is just falling out my ears.

Niall