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?
This is a discussion on Please explain the following function within the C++ Programming forums, part of the General Programming Boards category; I have come across a function definition starting as: Code: int operator*(vector &y) { body } After putting * just ...
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..
Manasij Mukherjee | gcc-4.8.0 @Arch Linux
Slow and Steady wins the race... if and only if :
1.None of the other participants are fast and steady.
2.The fast and unsteady suddenly falls asleep while running !
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.
Manasij Mukherjee | gcc-4.8.0 @Arch Linux
Slow and Steady wins the race... if and only if :
1.None of the other participants are fast and steady.
2.The fast and unsteady suddenly falls asleep while running !