[PHP-BUG] Bug #67785 [NEW]: Derived classes

[email protected] ("[email protected]")
Newsgroups php.standards
Message-ID <[email protected]>
From:             joelm
Operating system: 
PHP version:      Irrelevant
Package:          PHP Language Specification
Bug Type:         Bug
Bug description:Derived classes

Description:
------------
https://github.com/php/php-langspec/blob/master/spec/14-classes.md#classes

Derived classes get mentioned a fair amount throughout section 14 but
there is no one place that really pins down a lot of the rules about how
derived classes work. Here are some questions I don't think the spec
really answers that it should answer: 

 - What happens when a base class and a derived class both define a
public instance property named $x? Specifically how does storage work in
such cases? 
 (It appears that only one $x is allocated, and it has the initial value
of the most-derived declaration.)

 - What happens when a base class defines a private instance property
named $x and then a derived class declares a public or protected or
private instance property named $x? Specifically how does storage work
in such cases? (It appears that two $x’s are allocated.)

 - What happens when a base class defined a static property named $x and
then a derived class declares a static property named $x? How does
storage work in such cases? 

 - If the method body for C::foo defines a function static variable, and
then D derives from C and D does not override method foo, how does
storage for the function static work? 

 - What if there is a private instance method named "bar" and a
non-private instance method named "bar" within the same inheritance
hierarchy, and then a call site somewhere in the class hierarchy calls
instance method "bar". Which "bar" gets called? 



-- 
Edit bug report at https://bugs.php.net/bug.php?id=67785&edit=1
--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.