Home » Extra libraries, Code snippets, applications etc. » OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc » What happens with the virtual function PreDestroy in Linux?
Re: What happens with the virtual function PreDestroy in Linux? [message #5448 is a reply to message #5447] |
Fri, 22 September 2006 00:32 |
|
mirek
Messages: 13980 Registered: November 2005
|
Ultimate Member |
|
|
nicomesas wrote on Thu, 21 September 2006 18:25 | OK
Then, he is correct to use the destructor to make this type of things?
class someThing : public TopWindow
{
MySqlSession mySql ;
someThing()
{
mySql.Connect(...........) ;
}
virtual ~someThing()
{
mySql.Close() ;
}
}
I believe that still I have Windows mentality and I do not finish thinking that can do this and be to me so calm, but in fact works.
UPP is great
Nico
|
Actually, it is unnecessary. MySqlSession destructor Closes the connection itself, you do not have to care about it.
BTW, this is very basic U++ design: All resources *owned* by object are always released/finalized when the object is destroyed (but you can release them sooner). Applies e.g. to files, sockets, printer jobs etc, etc.. This is what makes U++ development superior to GC based systems.
|
|
|
Goto Forum:
Current Time: Wed May 15 12:41:55 CEST 2024
Total time taken to generate the page: 0.02975 seconds
|