Java Question Can 'extends' inherit documentation

barx

Well-Known Member
Licensed User
Longtime User
Good day to all.

Just wondering if using 'extends' can inherit documentation.

Example:

Super Class
Code:
class SuperClass{
    /**
    *Does something really useful with the passed string of text
    *Example:
    *wow = UsefulMethod("example text")
    */
    public void UsefulMethod(String text){
        //Do some cool stuff
    }
}

Sub Class
Code:
class SubClass extends SuperClass{

}

Doing this allows the UsefulMethod method to become available to use through the subclass BUT, the instructions are lost. Only way I have managed to do it is to copy the Documentation into the sub class. I guess this is kinda creating a pseudo method?

example

Code:
class SubClass extends SuperClass{
    /**
    *Does something really useful with the passed string of text
    *Example:
    *wow = UsefulMethod("example text")
    */
    public void UsefulMethod(String text){
        super.UsefulMethod(text)
    }
}

Is this the way to do it or is there a simple way?

Thanks
 
Maybe I'm doing something wrong then as I currently doesn't show.
I'll go over it again. Thanks.

Sent from my HTC Vision using Tapatalk
 
Just to re-light this old flame as I now could do with this working to help out Kevin in this thread.

I'm trying to extend the NotificationWrapper to add the required functionality.

I write

Code:
Public Class AdvancedNotification extends NotificationWrapper{

....New functions
....
}

When I add the library and try to use it the Tool Tips from the methods found in the original object are not present. Is it possible to Bring these forward.

Also, is it possible to access the private subs in the super class.

i.e. initiate

Code:
setValue(false, 2);

from new library?

Would I just be better copying the code of the original NotificationWrapper.

Thank you...
 
I wish I understood what you just said lol.

Could give a quick example? E.g. how would inherit the 'initialize' documentation.

Is it a matter of creating a method of initialize and it just calling super.initialize?

Thanks again.

Sent from my HTC Desire Z
 
Ah yes. Think you may be right. N00bs eh? We're hard work. Well I obviously don't have the source so will have to re-type them out. Not a massive issue. Cheers

Sent from my HTC Desire Z
 
Back
Top