Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualJuliean

Posted 09 April 2013 - 05:01 AM

You are returning "const go" from each of your operators. The operators themself take non-const reference, so this won't work. Returning by const value is useless anyway, just return "go". Also you should/need to define the input paramter to be "const go&".

 

EDIT: Damn, to slow ;)

 

EDIT2: Out of interest, did you really understand what you've been told that last thread you asked about the "temporary const return value"-thingy? Because this is pretty much related to this question...

 

EDIT3:

Solved: define the operator overloaded functions as global,but make them a friend to the class.That way,you can get your hands on both operands!

 

Thats utterly ugly. You shouldn't do that, declare the functions properly like described by me BitMaster, don't relate to such "hack-arounds" for simple things as operator overloading.


#3Juliean

Posted 09 April 2013 - 04:59 AM

You are returning "const go" from each of your operators. The operators themself take non-const reference, so this won't work. Returning by const value is useless anyway, just return "go". Also you should/need to define the input paramter to be "const go&".

 

EDIT: Damn, to slow ;)

 

EDIT2: Out of interest, did you really understand what you've been told that last thread you asked about the "temporary const return value"-thingy? Because this is pretty much related to this question...


#2Juliean

Posted 09 April 2013 - 04:58 AM

You are returning "const go" from each of your operators. The operators themself take non-const reference, so this won't work. Returning by const value is useless anyway, just return "go". Also you should/need to define the input paramter to be "const go&".

 

EDIT: Damn, to slow ;)


#1Juliean

Posted 09 April 2013 - 04:57 AM

You are returning "const go" from each of your operators. The operators themself take non-const reference, so this won't work. Returning by const value is useless anyway, just return "go".


PARTNERS