note 73467 deleted from function.get-class by peehaa
| From: | peehaa@php.net | Date: | Tue, 29 Nov 2016 10:26:18 +0000 |
| Subject: | note 73467 deleted from function.get-class by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207735@lists.php.net to get a copy of this message | ||
Note Submitter: spam at matsgefvert dot se
----
I disagree with the notion that the authors of the previous posts are unfamiliar with OOP. Without
the ability to know from general (parent) objects what kind of classes we're operating on, it
makes things rather difficult, especially in building frameworks that rely heavily on class types
(e.g. persistence layers).
The proposed BooBoof::getclass() and CooCoof::getclass() scheme will not work in some particular
scenarios since static calls aren't virtual, which means a parent class will always call its
own getclass() function instead of the one needed to find out the class name.
The only solution I've found is to pass along a string containing the class name we're
working on to the generalized functions. It is however an ugly solution, certainly less than ideal
and goes against what OOP and reflection is all about, IMHO.