|
Posted by Andy Hassall on 07/24/07 19:06
On Tue, 24 Jul 2007 18:44:02 GMT, Sanders Kaufman <bucky@kaufman.net> wrote:
>I'm having a BLAST writing this app as OOP as PHP allows. It's one
>thing to discuss the dance, but it's a thing of beauty to see the
>performance.
>
>I'm noticing that the constructor is a "reset" switch - just like the
>one on the front of my computer. Calling it seems to just dump all of
>the old values, free up all of the old resources, and return the object
>to a pristine state.
Hang on a minute - the constructor is called when creating a new object.
There's no old values, no old resources - you're creating a new object.
You may have created other objects of the same class previously - they'll
probably still be around somewhere.
Perhaps you want a singleton class? This often fits well for databases
resources.
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Navigation:
[Reply to this message]
|