Just a question: how do you define a new operation for a c++ primitive type?
I have defined a new class (A) and I have overloaded that operation *
So:
A test();
test * 2; //works
2 * test; //doesn't work
Just a question: how do you define a new operation for a c++ primitive type?
I have defined a new class (A) and I have overloaded that operation *
So:
A test();
test * 2; //works
2 * test; //doesn't work
struct A {
// ...
friend A operator * (A const& lhs, double rhs);
friend A operator * (double lhs, A const& rhs);
};