Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2008
    Thanked 0 Times in 0 Posts

    Arrow Inheritance using multiple constructors.


    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.

    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:

    class Inheri1 extends Inheri{
      protected int yarr;
      public Inheri1(){
        //doesn't matter what goes here
    It's producing the error message :

    ./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.


  2. #2
    Regular Coder Aradon's Avatar
    Join Date
    Jun 2005
    Thanked 20 Times in 19 Posts
    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts