Re[4]: [Dev-C++] "delete this" in the class member
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Oleksandr Y. <erm...@ma...> - 2004-01-31 19:51:38
|
Obi <ob...@ch...> wrote: > Also you need to be sure the instance is actually new-ed. If the instance > is an automatic or static variable callinf "delete this" will have undefined > behaviour, probably bad. > If you want to "delete this" you are recommended to have private > constructors and destructor. Use a factory method to create objects. Good idea. Thank you. Private constructor/destructors (friend'ed only for container of ptrs) will prevent incorrect using of this class. -- Best regards, Oleksandr mailto:erm...@ma... |