'extends' problem (Classes)

From: Date: Mon, 06 Oct 2003 17:09:49 +0000
Subject: 'extends' problem (Classes)
Groups: php.windows 
Request: Send a blank email to php-windows+get-21697@lists.php.net to get a copy of this message
Sorry if this is a double post for some of you, but I sent this email earlier today and had a strange email in a foreign language which seems like an email blocker. If any of you have received this email today, please delete it. Hi all, I am a newbie to OO programming in PHP, and am having a few teething problems with the extends keyword (inheritance). I think that the following code doesn't work because the 'Another' class doesn't extend the 'Something' class (I have created it, but is not in this sample code). Is there a problem with inheritance in PHP 4.2.3. The setX function is definded in the Something class which isnt shown. Also, when I type the word 'extends' it doesn't get highlighted as being a key word. Can some please help. (am using Apache on XP) <?php class Another extends Something { var $y; function setY($v) { $this->y=$v; } function getY() { return $this->y; } } // Another class $obj2 = new Something; $obj2->setX(5); $obj2->setY(6); // End Code Tryst

« previous php.windows (#21697) next »