did you have your inheritance mixed up? (or maybe it was a typo) if > class Another extends Something { then > $obj2 = new Something; > $obj2->setX(5); > $obj2->setY(6); would yield setY not found, because setY is not in Something. Ie, both methods are available in "Another", only setX is in "Something". (Something being the ancestor) I know this could be just a typo, so if it is, then you might want to look at how you require the file that has class Something in it. <Trystano@aol.com> wrote in message a2.3d084d91.2cb2fbdd@aol.com">news:a2.3d084d91.2cb2fbdd@aol.com... > 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 -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php