Mail Archives: djgpp/1997/03/29/07:48:48
> > Q1) delete(s); EQUAL TO delete(f) ??
>
> If they point to the same object (which they do here), yes.
Even If I do :
void *p;
p=(void *)s;
delete(p) EQUAL TO delete(s) ??
So delete doesn't need to know the type of pointer to free memory !
Great!
Another question :
Do delete call the destructor when is argument is a pointer to a class ?
> > Q3) I could use a virtual function calling the good destructor for each
> > kind of class but I'm not sure the destructor free the memory taken by the new function ??
> Huh? Just make your destructor virtual and do the right thing there. (You
> can make destructors virtual, but not constructors.*)
I'm not sure but it seem when you call a destructor you need to makeout
the class type like this ' s->son::~son() ' . So If I don't know the
class type (here son) it's not possible ! Don't you ?
Thank for your help
Hilaire
- Raw text -