Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is no return type specified in this function clearly returns? [duplicate]

Tags:

c++

Possible Duplicate:
Operator overloading

I am seeing this in a piece of sample code:

operator Vector2<float>() const    {       
  return Vector2<float>(x, y);    }

My 2 questions about this:

1) The function clearly returns, but there's no return type specified?

2) It's not clear exactly what is getting overloaded here, which operator.

like image 478
johnbakers Avatar asked Dec 17 '12 09:12

johnbakers


1 Answers

It's a conversion operator, and the return type is Vector2<float>.

like image 57
Nim Avatar answered Sep 21 '22 22:09

Nim