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?
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.
It is too clear and so it is hard to see.
A dunce once searched for fire with a lighted lantern.
Had he known what fire was,
He could have cooked his rice much sooner.