simulating object upcasting to an interface in PHP 4

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

In Java one is supposed to upcast an object to its interface whenever

MyInterface customers = new MySpecificClass();

The idea is that if later one wants to change the specific
implementation one only has to change a few lines, possibly just the
one line above. Thus the code becomes more flexible.

Is it right to say that there is no way to do this in PHP? I've taken
to simulating the same by using one object as a mask that sets and
then uses another object:

myMaskObj = new MaskDatabase();

myMaskObj->query("SELECT * FROM content WHERE type='comments'");

MaskDatabase has a method called "query" which simply passes the query
along to DatabaseObject which also has a method called query.

Other ideas?

Site Timeline