Actually i've tried it stopping at the getClass() as well.
But i realised doing this shouldnt be necessary in what i was trying
to do (implementation of observer pattern).
Passing in the interface as an argument would give objects access to
the unique method of each interface thus rendering the need to cast
object types obsolete.
Otherwise in other instances if you were to directly couple an object
with prior knowledge of the type then you could just cast it as the
type straight away.

Thanks for the suggestions anyway guys!

On May 5, 6:02 pm, Salvador Diaz <[email protected]> wrote:
> > for(Widget widget:array)
> > {
> >         ((this.getParent().getClass().getName()) widget).someMethod
> > (this);
>
> > }
>
> You went a step too far, try stoping at getClass()
>
> >((this.getParent().getClass()) widget).someMethod
>
> I don't know if that will work though, you'll have to try for yourself.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to