note 73467 added to function.get-class
| From: | spam at matsgefvert dot se | Date: | Sat, 24 Feb 2007 09:37:01 +0000 |
| Subject: | note 73467 added to function.get-class | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123799@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 193.27.201.10 (proxied: 193.27.201.10 1.0 www1.shellkonto.se:3128 (squid/2.5.STABLE4))
Probable Submitter: 83.252.76.176
----
Manual Page -- http://www.php.net/manual/en/function.get-class.php
Edit -- https://master.php.net/note/edit/73467
Del: integrated -- https://master.php.net/note/delete/73467/integrated
Del: useless -- https://master.php.net/note/delete/73467/useless
Del: bad code -- https://master.php.net/note/delete/73467/bad+code
Del: spam -- https://master.php.net/note/delete/73467/spam
Del: non-english -- https://master.php.net/note/delete/73467/non-english
Del: in docs -- https://master.php.net/note/delete/73467/in+docs
Del: other reasons-- https://master.php.net/note/delete/73467
Reject -- https://master.php.net/note/reject/73467
Search -- https://master.php.net/manage/user-notes.php