It outputs 'bool(false)', while I expect it to print 'int(123)'.
Foo::id is private so Bar::setId() cannot use it. It uses an implicit public Bar::id (different from Foo::id).
Foo::getId() correctly read the private attribute Foo::id (not the public Bar::id) and return it.
Am I missing something and this is really expected behaviour ?
I think it is.
- if we allow Bar::setId() to change Foo::id, "private" keyword is useless
- if we allow Foo::getId() to read Bar::id instead of Foo:id, then a derived class can pertubate private things in the mother class (which is not a good solution).
-- Eric Daspet
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php