|
Posted by Jerry Stuckle on 08/09/06 00:15
wildernesscat wrote:
> Hi Jerry,
>
> I'm trying to write a function that checks whether a given object is of
> a known class (named 'A' in this example). I want it to work even if
> the object has been constructed manually, starting from 'new
> StdClass()'.
>
> Danny
>
>
Yes, that's a lot different than your original question.
You can use is_a() as Marcin suggested. But what's to stop me from
creating my own class 'A'?
The real question is - why do you need this "feature"? It violates
several principles of OO.
OO principles include that you don't care WHAT the object is - all you
care about is its interface (functions). If you need to depend on a
specific class, you need to rethink your design.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|