note 30120 added to language.oop
| From: | mad dot murdock at unknown dot com | Date: | Fri, 07 Mar 2003 01:34:43 +0000 |
| Subject: | note 30120 added to language.oop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44960@lists.php.net to get a copy of this message | ||
re: immo at nospam dot org
While this useful example is correct, it contains a few redundant lines that might be a little
confusing...
class MemberObject extends ParentObject {
var $string;
function MemberObject() {
$this->string = "This is a test string.";
$this->ParentObject(); //this line is not needed as the ParentObject funtion is a
constructor for ParentObject class, which MemberObject is extending. Thus, it inherits it and since
it is a constructor, it is executed automatically.//
}
}
also
class ObjTest {
var $ObjPointer;
function ObjTest() {
$tmp = new MemberObject;
$this->ObjPointer = $tmp;
}
}
could be
class ObjTest {
var $ObjPointer;
function ObjTest() {
$this->ObjPointer = new MemberObject;
}
}
--
http://www.php.net/manual/en/language.oop.php
http://master.php.net/manage/user-notes.php?action=edit+30120
http://master.php.net/manage/user-notes.php?action=delete+30120
http://master.php.net/manage/user-notes.php?action=reject+30120