Overloaded operands and function definitions Question

Is it possible to write two or more function definitions for the + operator and place them both is a struct definition? Why or why not?
My understanding is that if you are going to add two different types together, you will need to define to overloaded operator members to handle the two different ways the parameters can be added.
Yes, you can have any number of overloaded + operators as long as all the function parameters are different. (unique signature)
Last edited on
Consider the example

struct A
   const A operator +( const A & ) { return ( A() ); }
   const A operator +( const A & ) const { return ( A() ); }
Topic archived. No new replies allowed.