|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-01-20 12:31 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 01:00:02 2025 UTC |
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)