Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-23-2008, 02:19 PM   PM User | #1
Marcuss
New to the CF scene

 
Join Date: Mar 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Marcuss is an unknown quantity at this point
Arrow Inheritance using multiple constructors.

Hello.

I'm having some small issues when attempting to extend a class. The example is an abstraction of what i'm attempting to do, but it still produces the same error message.

Code:
class Inheri{

  protected Object ar;
  protected Inheri1 ir;

  public Inheri(Object o){
    ar = o;
  }

  public Inheri(Object o, Inheri1 i){
    ar = o;
    ir = i;
  }

  //any old methods

}
And i'd like to just extend it, so:

Code:
class Inheri1 extends Inheri{

  protected int yarr;

  public Inheri1(){

    //doesn't matter what goes here

  }

}
It's producing the error message :

Code:
./Inheri1.java:5: cannot find symbol
symbol  : constructor Inheri()
location: class Inheri
public Inheri1(){}
                ^
It seems to not like multiple constructors in the Inheri class, but I'm not entirely sure how to resolve it, as far as I can see everything is fine. I'm sure I'm sure I'm lacking an elementary understanding here though.

Thank you for any help in advance.

-Marcus
Marcuss is offline   Reply With Quote
Old 04-23-2008, 05:36 PM   PM User | #2
Aradon
Moderator-san


 
Aradon's Avatar
 
Join Date: Jun 2005
Location: USA
Posts: 734
Thanks: 0
Thanked 20 Times in 19 Posts
Aradon is on a distinguished road
Are you calling super? If so how are you calling it? just super() or super(object) ?

Also, why are you using Inheri1 in your Inheri class?

You want your Inheri1 class to handle Inheri1 objects and your Inheri class to handle Inheri objects (and those in which are sub-divided into it)
__________________
"To iterate is human, to recurse divine." -L. Peter Deutsch
Aradon is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:24 AM.


Advertisement
Log in to turn off these ads.