Question about overloading operators

Hi,

I want to overload the operator '*', so I will be able to compile these 2 lines:

1
2
MyClass clss1(1,2), clss2();
clss2 = 0.5 * clss1;


My question is how can I use the double variable in my overloading function?
In MyClass I wrote:

1
2
3
MyClass operator *(const MyClass& mcl){
...
}


What do I have to write in the function so I will be able to use the double variable (in this case it was 0.5)?

Thanks.
You need to use non-member operator overloading for this.
What do you mean by non-member operator?
Topic archived. No new replies allowed.