The Artima Developer Community
Sponsored Link

Java Answers Forum
inheritence

4 replies on 1 page. Most recent reply: Jul 25, 2003 10:45 AM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
sriram

Posts: 11
Nickname: scorpkris
Registered: Jul, 2003

inheritence Posted: Jul 24, 2003 11:00 PM
Reply to this message Reply
Advertisement
can i inherit from 2 classes.
like public class myapp extends Applet,Frame implements....

is this possible.
if there is another way of doing the same, then plz help.


zenykx

Posts: 69
Nickname: zenykx
Registered: May, 2003

Re: inheritence Posted: Jul 25, 2003 3:26 AM
Reply to this message Reply
I think the easy way is RTFM ... and you will see what is java about.
No you cannot use multiple inheritence in java !!!!

Dor

Posts: 13
Nickname: eis
Registered: Jul, 2003

Re: inheritence Posted: Jul 25, 2003 4:00 AM
Reply to this message Reply
Maybe you could try inner classes.

Greg Lehane

Posts: 33
Nickname: glehane
Registered: Jun, 2003

Re: inheritence Posted: Jul 25, 2003 10:38 AM
Reply to this message Reply
No multiple inheritance in Java. You can get around it using interfaces. This is well documented. For example:

http://csis.pace.edu/~bergin/patterns/multipleinheritance.html

(random google search)

=- Greg

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: inheritence Posted: Jul 25, 2003 10:45 AM
Reply to this message Reply
If you are trying to get the behavior of both classes, then use Greg's suggestion.

If you are trying to get the implementation of both classes, then you probably want to use composition. I don't have any links for that, but searching for "Java and composition" or similar things on this site, or on Google should turn up plenty of material.

Flat View: This topic has 4 replies on 1 page
Topic: how to invoke excel8.0 from Java Previous Topic   Next Topic Topic: how to display the registered trade mark in xml

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use