You are here: Re: Test for the existence of a null property « PHP Programming Language « IT news, forums, messages
Re: Test for the existence of a null property

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация