|
Posted by Toby A Inkster on 07/25/07 08:42
Sanders Kaufman wrote:
> 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.
Yes, you can do this, but it's a bit of a hack. Better to use something
like:
class Foobar
{
public $var1;
public $var2;
public function __construct ($foo, $bar)
{
$this->reset($foo, $bar);
// Now maybe do some other stuff
}
public function reset ($foo, $bar)
{
$this->var1 = $foo;
$this->var2 = $bar;
}
}
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 34 days, 12:16.]
Cryptography Challenge
http://tobyinkster.co.uk/blog/2007/07/24/crypto-challenge/
[Back to original message]
|