int operator*(vector &y)
{
body
}
After putting * just after operator and before opening brace of argument what this function means?




Posted 24 July 2011 - 10:22 AM
Posted 24 July 2011 - 11:18 AM
struct vector {
int x, y;
vector(int newX, int newY) : x(newX), y(newY) {}
int operator*(vector &v) {
return x * v.x + y * v.y;
}
};
vector v1(1, 2), v2(3, 4); int result = v1 * v2;
v1.x * v2.x + v1.y * v2.y
This post has been edited by Hezekiah: 24 July 2011 - 11:19 AM
|
|
Query failed: connection to localhost:3312 failed (errno=111, msg=Connection refused).
|
