dcsimg
HELP - Applet implementation question
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Haig_Haig
Posted On:   Wednesday, September 25, 2002 07:59 AM

I have an application that uses 3 classes. For simplicity, let's call them C1, C2 and C3, where C3 extends C2 and C2 extends C1. I want to deploy this application as an applet. Obviously, one of these classes needs to extend Applet and override the init(), start(), stop() and destroy() methods, but it can't be C3or C2, since Java does not allow for multiple inheritance. My question is what is the best way to implement this: 1) Create a new class called C4, which extends Applet and imports C3? OR 2) Have C1 extend Applet and override the 4 methods, and override the 4 methods in C2 and finally, in C3? HELP!!!    More>>

I have an application that uses 3 classes.
For simplicity, let's call them C1, C2 and C3, where C3 extends C2 and C2 extends C1.

I want to deploy this application as an applet.
Obviously, one of these classes needs to extend Applet and override
the init(), start(), stop() and destroy() methods,
but it can't be C3or C2, since Java does not allow for multiple inheritance.

My question is what is the best way to implement this:
1) Create a new class called C4, which extends Applet and imports C3?
OR
2) Have C1 extend Applet and override the 4 methods, and override the 4 methods in C2 and finally, in C3?


HELP!!!

   <<Less

Re: HELP - Applet implementation question

Posted By:   Christopher_Koenigsberg  
Posted On:   Wednesday, September 25, 2002 12:24 PM

I think your choice #1 is the better way to go, to extend Applet directly and then have the other classes be used as member fields, inside the one that extends Applet. ("prefer composition to inheritance")

About | Sitemap | Contact