Questions tagged [method-signature]

In computer programming, especially object-oriented programming, a method is commonly identified by its unique method signature, which usually includes the method name, and the number, types and order of its parameters. A method signature is the smallest type of a method.

Method signature

In computer programming, especially object-oriented programming, a method is commonly identified by its unique method signature, which usually includes the method name, and the number, types and order of its parameters. A method signature is the smallest type of a method.

Method overloading

Method signatures can be used by the compiler to distinguish between methods with the same name, but with different parameters. This is called . The precise characteristics of method overloading depends on the programming language. Overloading should not be used for methods that perform an different operation as that will make the source code hard to read.

Examples

Example of declarations of two overloaded methods with the same name, but with a different method signature:

void drawPoint(int x, int y);
void drawPoint(Point p);

in this case it is likely that drawPoint(x, y) internally converts x and y into a Point instance. This kind of function is therefore called a convenience method.

Related questions

234 questions
-1
votes
1 answer

Why doesn't Java support adding `throws` to the method signature?

This is a question that is being around in my head for days. When it comes to inheritance and polymorphism, Java support covariant return types through the bridge method concept. But why doesn't they implement a concept like bridge method to the…
Clarke
  • 185
  • 10
-1
votes
2 answers

c# Monitor changes in critical method signatures during build

I stumbled into a cooperation project, where the other part references an interface library of mine and deploys a self compiled MEF Plugin for our tool. I know which methods those guys are using and I want to monitor our library during the the build…
Monga
  • 29
  • 3
-1
votes
1 answer

Is there a standard function signature for the digital signature "verify" function?

Is one of these (or something else) more standard than the alternatives? verify(message, signature, publicKey) vs verify(signature, message, publicKey)
-1
votes
4 answers

Signature Invalid for yodlee

Using token,token secret,Consumer key,Consumer secret,time-stamp,nonce i generate the signature using developer account but it always shows the Signature invalid while connect the fast link of yodlee, May be the generated signature method wrong, Can…
-2
votes
1 answer

How to read a TypeScript signature with multiple arrows and generics?

I am trying to understand this TypeScript signature from react-hook-forms: handleSubmit: (onValid: SubmitHandler, onInvalid?: SubmitErrorHandler) => (e?:…
stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270
-2
votes
1 answer

Why Are There Three Words In Some Protocol Init Signatures

When I write a new method signature in Swift, I follow the pattern: func methodName(varName1: VarType1, varName2: VarType2, ...) { Looking at some of the required protocol initializers, I have found a mystery third word in the signature. For…
Alex311
  • 378
  • 3
  • 12
-2
votes
2 answers

Option Strict error with method signatures

Option Strict throws some errores in these signatures: Private Sub NotifyIcon_Systray_Click(ByVal sender As Object, ByVal e As MouseEventArgs) _ Handles RadMenuItem_Hide.Click, RadMenuItem_Show.Click, …
ElektroStudios
  • 19,105
  • 33
  • 200
  • 417
-4
votes
1 answer

Problem with Ruby Documentation

I am new with Ruby and I don't understand ruby Documentation.I cut a piece of ruby documentation. please explain completely this piece. thanks
amir amir
  • 3,375
  • 7
  • 26
  • 29
-8
votes
1 answer

C# method signatures - restricting types - what's the correct terminology?

I have a method in the Common class of a project I am working on which is defined like this: public static void PopulateSoapBody(Object obj, string[] aMessage) where TEnum : struct, IComparable, IFormattable, IConvertible and it is called…
anon
1 2 3
15
16