|
-
April 6th, 1999, 01:28 AM
#1
HELP! delete function using base-class pointer
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|