At 23:25 10.04.2002, Lauri Liinat wrote: > > If you want to access an aggregated object directly you can do: > > $obj->Timer->method(); > >well, that's exactly what shouldn't be done and what polymorphism >is trying to eliminate... consider a huge code library which operates >on an object of class Timer and that we want to reuse this library. >now if we hand it an aggregated object whose method() points to >the wrong method() we would have to search-and-replace, that is, >more or less manually change all occurences of ->method(); into >->Timer->method(); - would you say this is feasible?? the whole >idea of polymorphism is to allow both implicit reuse and implicit >growth of code base. if a technique that is supposed to head towards >code reuse requires a single implicit call to be manually hunt down and >changed into an explicit one, then it's quite useless i'd say... having MI >and casts you would simply: > >big_hairy_library_call( (Timer) $MI_obj ); > >...and be done with it. as a bonus, you get to sleep the whole night >instead of searching-and-replacing text in somebody else's library >till the early morning... nothing personal, just trying to provide a >scenario :) > >lauri
Where is the big difference (first is postfix syntax, second is prefix syntax). And as we have no typesystem we cannot use typecasting but another solution. marcus -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php