Results 1 to 4 of 4
  1. #1
    Stubkan is offline Member
    Join Date
    Mar 2012
    Location
    Melbourne
    Posts
    2
    Rep Power
    0

    Default Struggling with overriding abstract classes

    Hi,
    I have been struggling with code - mainly because I'm both learning Java and trying to make a mod for minecraft at the same time...

    I am not getting much communication from the Minecraft community, so I am trying over here. I think perhaps because so many people with zero knowledge of Java ask for others to do most of the work for them.

    What I'm trying to do is - make a mod for the game Minecraft that will display visual representations of sounds - good for the Deaf and hard of hearing!

    I took some code that renders text on the screen and made a subclass of an abstract class which deals with rendering - I've taken the code from another subclass of this renderer.

    As far as I can see, I'm doing the same thing all the other subclasses are doing but the compiler refuses to let it work. It returns a 'renderCaption is not abstract and does not overrride abstract method doRender' error ... I've been trying to figure it out for the last few days... Going over the Java tutorials constantly, but can't figure it out.

    I don't think Minecraft is open source so I won't post it's code, just my subclass's code..
    I really hope someone can give me some pointers!

    Here is a copy of the subclass renderCaption ;

    https://gist.github.com/2014869

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default Re: Struggling with overriding abstract classes

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Stubkan is offline Member
    Join Date
    Mar 2012
    Location
    Melbourne
    Posts
    2
    Rep Power
    0

    Default Re: Struggling with overriding abstract classes

    Thank you, but I am actually quite familiar with that page.

    It says I need to implement all the abstract methods contained in the abstract superclass into my subclass.
    There appears to be only one abstract method in 'Render' and that is 'doRender'.

    I've implemented it and it doesn't compile. I checked all the other subclasses, they are doing it the same way as far as I can see.
    Also, theres a class constructor - with the same name as the java file for each subclass, I've put that in too.
    I've imported the relevant stuff at the top...

    I am finding it difficult to pinpoint what is missing.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default Re: Struggling with overriding abstract classes

    Quote Originally Posted by Stubkan View Post
    There appears to be only one abstract method in 'Render' and that is 'doRender'.

    I've implemented it and it doesn't compile.
    Then you haven't implemented the method as defined. The entire method signature must match -- name, parameters and return type.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Abstract classes
    By FadedAura in forum New To Java
    Replies: 4
    Last Post: 11-21-2011, 10:16 PM
  2. Overriding the abstract method
    By wramhoff in forum New To Java
    Replies: 2
    Last Post: 10-08-2011, 02:48 PM
  3. abstract classes
    By renju krishnan in forum New To Java
    Replies: 1
    Last Post: 09-29-2010, 08:31 AM
  4. Replies: 7
    Last Post: 02-26-2009, 06:46 AM
  5. Replies: 3
    Last Post: 04-08-2008, 07:12 AM

Posting Permissions

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