Re: Q on Class and EXTEND
| From: | John W. Holmes | Date: | Wed, 03 Sep 2003 16:55:13 +0000 |
| Subject: | Re: Q on Class and EXTEND | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161569@lists.php.net to get a copy of this message | ||
jsWalter wrote:
It doesn't work that way, exactly. The child class can define new methods and properties, but you must make an instance of the child class, which will include the methods/properties from the parent, and the new ones you have written. If I'm understanding you correctly, you could rename you parent class to child, name the child class the same as your parent and have the "old class" extend the "new class" you've written. You code should then work the same, but have the new methods/properties available. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com-----Original Message----- From: Matt Matijevich [mailto:matijevich@alliancetechnologies.net] I dont know much about classes, but dont you want $a = new THECHILD('walter'); //so you can access $a->abc instead of $a = new THEPARENT ('walter');No, I'm wanting to EXTEND the orginal class. meaning, my THECHILD class efines new methods/properties, and I want it used as if it was part of the orginal THEPARENT Class. Me just being picky.