I have come across a function definition starting as:
Code:int operator*(vector &y)
{
body
}
After putting * just after operator and before opening brace of argument what this function means?
Printable View
I have come across a function definition starting as:
Code:int operator*(vector &y)
{
body
}
After putting * just after operator and before opening brace of argument what this function means?
It means that :
If you've seen it within a class:
an object of the class when used as : object * somevector ; will yield an integer. Exactly how it'll happen, depends upon the definition..
And if not within a class, it's unary *, meaning it defines the result of *v, for a vector v.