C
curious user
I've tried asking jeeves.
Is it the pattern of formal parameters for a method?
Is it the pattern of formal parameters for a method?
curious user said:I've tried asking jeeves.
Is it the pattern of formal parameters for a method?
VisionSet said:It is everything in the method declaration req'd to override an exisiting
method.
For instance in a super class
private void myMethod(String foo, int bar) {}
For a subclass to override myMethod it must declare it as:
x void myMethod(String myStringName, int myIntName) {}
where x is a visibility modifier that is equal to the superclasses or more
public, so in this case it can be anything, but if the superclass method was
public then it could only be public.
If you did not obey this and still used the method name myMethod, then the
compiler would complain.
If the parameters were different or ordered differently, eg (int myInt,
String myString)
Then this would be treated as a different method, this is legal, but would
not be overriding the original. Hence this is still part of the signature.
Is it the pattern of formal parameters for a method?
I've tried asking jeeves.
Is it the pattern of formal parameters for a method?
Roedy Green said:yes. It is also a shorthand that Java uses internally in the class
file to describe it. See http://mindprod.com/jgloss/signature.html
curious said:I've tried asking jeeves.
Is it the pattern of formal parameters for a method?
This is different from C and C++, right? In those languages, a
signature does not include the return type.
I've tried asking jeeves.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.