signature

T

Tony Johansson

Hello !!


I do know that the name and the parameter are includet in a methode
signature but what abot the return type are then also includet in the
signature.

//Tony
 
I

Ioannis Vranos

Tony said:
Hello !!


I do know that the name and the parameter are includet in a methode
signature but what abot the return type are then also includet in the
signature.


When we are talking in general, we usually consider the return type to be part of the
function signature.

When we are talking about function overloading specifically, the return type does not
matter on which function will be called.
 
K

Karl Heinz Buchegger

Tony said:
Hello !!

I do know that the name and the parameter are includet in a methode
signature but what abot the return type are then also includet in the
signature.

No.
 
J

Jaspreet

Tony said:
Hello !!


I do know that the name and the parameter are includet in a methode
signature but what abot the return type are then also includet in the
signature.

//Tony

I guess you are talking in reference to function overloading. If that
is so then the return type is ir-relevant. The number or type of
arguments should be different for functions to be overloaded.

There is something called function prototype which is of the form:
return_type function_name (arguments);

Not sure though what your context is..
 
M

MJ

Hi
You can not overload the function based on the return type, even though
the return type is included in the signature
MJ
 
I

Ioannis Vranos

Rolf said:
From the C++ standard:

1.3.10 signature defns.signature]
the information about a function that participates in overload resolution
(13.3): the types of its parameters and, if the function is a class member,
the cv- qualifiers (if any) on the function itself and the class in which
the member function is declared.2) The signature of a template function
specialization includes the types of its template arguments (14.5.5.1).

[...]

2) Function signatures do not include return type, because that does not
participate in overload resolution.


However return types are taken under consideration when using pointers to functions.
 
R

Rolf Magnus

MJ said:
Hi
You can not overload the function based on the return type, even though
the return type is included in the signature

From the C++ standard:

1.3.10 signature defns.signature]
the information about a function that participates in overload resolution
(13.3): the types of its parameters and, if the function is a class member,
the cv- qualifiers (if any) on the function itself and the class in which
the member function is declared.2) The signature of a template function
specialization includes the types of its template arguments (14.5.5.1).

[...]

2) Function signatures do not include return type, because that does not
participate in overload resolution.
 
R

Ron Natalie

Ioannis said:
However return types are taken under consideration when using pointers
to functions.
That's because the return type is part of the function TYPE. When you
declare a pointer to function, you're declaring a pointer to some
function type.

SIGNATURE is the stuff that applies to overloading (as posted earlier).
The return type is not a factor in overloading.

While people frequently intermix TYPE and SIGNATURE in conversation,
they are not the same thing.
 
I

Ioannis Vranos

Ron said:
That's because the return type is part of the function TYPE. When you
declare a pointer to function, you're declaring a pointer to some
function type.

SIGNATURE is the stuff that applies to overloading (as posted earlier).
The return type is not a factor in overloading.

While people frequently intermix TYPE and SIGNATURE in conversation,
they are not the same thing.


Interesting. Thanks for the clarification. :)
 
R

Ron Natalie

Ron said:
That's because the return type is part of the function TYPE. When you
declare a pointer to function, you're declaring a pointer to some
function type.

SIGNATURE is the stuff that applies to overloading (as posted earlier).
The return type is not a factor in overloading.

While people frequently intermix TYPE and SIGNATURE in conversation,
they are not the same thing.

I should further point out that the SIGNATURE includes the name of
the function (along with the types of the arguments) where as the
type does not include the name.
 

Ask a Question

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.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top