Bug #67785 [Opn->Csd]: Derived classes

From: Date: Sun, 28 Jun 2015 22:03:40 +0000
Subject: Bug #67785 [Opn->Csd]: Derived classes
References: 1  Groups: php.standards 
Request: Send a blank email to standards-+get-825@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67785&edit=1 ID: 67785 Updated by: stas@php.net Reported by: joelm@php.net Summary: Derived classes -Status: Open +Status: Closed Type: Bug Package: PHP Language Specification PHP Version: Irrelevant -Assigned To: +Assigned To: stas Block user comment: N Private report: N New Comment: The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. I think the "Inheritance" section now covers this. Previous Comments: ------------------------------------------------------------------------ [2014-08-05 17:16:34] joelm@php.net 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 this bug report at https://bugs.php.net/bug.php?id=67785&edit=1

« previous php.standards (#825) next »