ID: 47163 Updated by: j...@php.net Reported By: vivekanandan8 at yahoo dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: debian linux PHP Version: 5.2.6 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2009-01-20 10:54:13] vivekanandan8 at yahoo dot com Description: ------------ i am using php 5.2.6 in debian linux platform.Having common member variables names in classes used in inheritance still has problem. when we declare as private for both member variable it works fine but when we declare parent member variable as public , it throws error Expected result: needs seperate copy of the member variable as the same behaviour as both are private. Actual Result: Access level to son::$mName must be public (as in class dad) i vivek Reproduce code: --------------- <? class dad { public $mName; function setDADName(){ $this->mName='father'; } } class son extends dad { private $mName; function setSONName(){ $this->mName='child'; } } $oChildObj = new son; $oChildObj->setDADName(); $oChildObj->setSONName(); ?> Expected result: ---------------- both call to same member variable successfully assign value to $mName same as when they are private in both clases(dad,son). Actual result: -------------- Access level to son::$mName must be public (as in class dad) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47163&edit=1