Object Constructors -- Part II

From: Date: Fri, 15 Sep 2000 19:47:07 +0000
Subject: Object Constructors -- Part II
Groups: php.general 
Request: Send a blank email to php-general+get-16981@lists.php.net to get a copy of this message
Well, it turns out that it was my own terrible typo that was causing the error on a constructor with passed variables. However... I am getting another error with constructor overloading. Here's a code sample: class openFile { var $myfile; function openFile() { $this->myFile = "/var/logs/somefile"; } function openFile($f) { $this->myFile = $f; } } this is how i'm newing the object: $of = new of; I am getting this error from PHP though: Warning: Missing argument 1 for log() in log.inc on line 8 I wanted to have both constructors in there so I could have a "default" filename as well as one i could specify when the object gets created. Any ideas on what's happening here? Thanks

« previous php.general (#16981) next »