Clan x86

Technical (Development, Security, etc.) => General Programming => Topic started by: Joe on April 04, 2006, 11:31:35 PM

Title: [Java] Implementing Interfaces
Post by: Joe on April 04, 2006, 11:31:35 PM
In my free time in Comp Prog, I'm writing an IRC client, but that's beside the point (mostly). I've written a EventCallbacks interface and implemented it in both SwingUI and ConsoleUI. I want to be able to pass the reference to the UI to the Connection class so that it can fire their callbacks. Do I just pass it as EventCallback UI or as a java.lang.Object, or what?

EDIT -
I may not be able to read this in the morning, so could you drop the answer in an email to wlafrance@baraboo.k12.wi.us as well, please? (It's for class, so eh?)
Thanks.
Title: Re: [Java] Implementing Interfaces
Post by: iago on April 05, 2006, 10:20:48 AM
You should be able to pass it as an EventCallback, if you're implementing EventCallback. 

Welcome to polymorphism...
Title: Re: [Java] Implementing Interfaces
Post by: MyndFyre on April 05, 2006, 11:14:08 AM
Quote from: iago on April 05, 2006, 10:20:48 AM
You should be able to pass it as an EventCallback, if you're implementing EventCallback. 

Welcome to polymorphism...

Hahaha, that's not far from what I told him.  ;)