First let me say that I have done quite a bit of reading this morning and have been employing OOP techniques for several years in other languages and I have found something that seems strange to me (given the early hour, lots of things seem strange). If I have a property declared in a class, extend that class with an identical property declaration but different value, instantiate the extended class, and return the property it is the property of the parent class. I found this quite by accident, I wasn't really paying attention when I wrote the extension class. So then I did a little exploration, reading especially the http://us2.php.net/overload info. But something doesn't seem right to me. Here is some code to illustrate what I found; (lots o' snippage, only what counts);
------------------------------------------------------------ class AGENT{ /* ** 2003-09-04 jb PRIVATE PROPERTIES */ var $strCommCode; // agent commission code ------------------------------------------------------------ ------------------------------------------------------------ function AGENT(){ // class pseudo-constructor /* ** 2003-09-09 jb initialize properties */ $this->strCommCode = 'COINBASE'; ------------------------------------------------------------ ------------------------------------------------------------ require("agentclass.php"); class COIN extends AGENT { var $strCommCode = 'COIN0JAY'; } /* ** instantiate new COIN object */ $objDime = new COIN(); echo $objDime->strCommCode."\n"; ------------------------------------------------------------ The result of $objDime->strCommCode is 'COINBASE'...my thinking is that it should be 'COIN0JAY' Now really I didn't want to initialize a property for strCommCode in the parent class. The property should get set in the extension class. I know that a property will get over-ridden in the child class pseudo-constructor if it gets addressed, like adding this to the COIN class above; function COIN(){ // pseudo-constructor $this->strCommCode = 'COIN0JAY'; // overrides parent strCommCode } With error reporting set (E_ALL) no errors occur before (or after, for that matter) adding the COIN pseudo-constructor. Having said all of that it just piqued my curiosity. I understand that each property is private to its class, but during an extension of the class aren't all properties private to the extended class? Just some curiosities....discussion welcome, no problems with current project. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php