• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inheritance question

 
ilteris kaplan
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Hunters;

I am trying to implement inheritance in my application and here is the deal.

I have a Tag class that gets data tag etc. as its constructor, and I have a displayTag class which I want to both be subclass of my Tag class so that it could get the variables and methods that Tag have and plus I want it to extend PApplet class so that I could use processing methods in this displayTag class. (it is the main reason I am separating the tag and tagDisplay classes.

So when I try to do something like;

public class TagDisplay extends PApplet extends Tag {
TagDisplay(String sUrl_,int numOfApp_, String tag_, String descrpath_) {
super(sUrl_, numOfApp_, tag_, descrpath_);
}

}

well it doesn't work... what am I missing here? Also one other question is eclipse is throwing me this warning of "The serializable class TagDisplay does not declare a static final serialVersion UID field of type long" and advices me to create this line of code :

/**
*
*/
private static final longserialVersionUID= 3082584054442772747L;



Can someone explain what is going on here?

best
ilteris.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34860
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ilteris,
Java only allows single inheritance - in other words you can only extend one class at a time.

A common way around this is to instantiate a Tag within your DisplayTag class and use the methods that way. Another common way is to use an interface - but that wouldn't work here - you want the functionality.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34860
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this thread for the serialVersionUID part of your question.
 
ilteris kaplan
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the quick response Jeanne!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic