3 Replies - 155 Views - Last Post: 09 December 2012 - 05:54 AM Rate Topic: -----

#1 Gardezi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 29-October 12

Member function vs global function

Posted 09 December 2012 - 05:05 AM

Does global function has more precedence over member function in operator overloading .
Is This A Good Question/Topic? 0
  • +

Replies To: Member function vs global function

#2 AKMafia001  Icon User is online

  • </code.in.dream>

Reputation: 183
  • View blog
  • Posts: 616
  • Joined: 11-June 11

Re: Member function vs global function

Posted 09 December 2012 - 05:14 AM

Read this excellent post by Salem_c...

I thought the OP is asking that, what would be the precedence of function calls in an expression...

And I even didn't see in operator overloading, don't know how I missed that... Sorry!

This post has been edited by AKMafia001: 09 December 2012 - 06:05 AM

Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5954
  • View blog
  • Posts: 23,224
  • Joined: 23-August 08

Re: Member function vs global function

Posted 09 December 2012 - 05:27 AM

"Function precedence"? Not a term I've heard. If you're having trouble with some code you've written -- it's not doing what you expect -- then post the code (in CODE tags) and tell us what you're seeing.
Was This Post Helpful? 0
  • +
  • -

#4 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2015
  • View blog
  • Posts: 3,041
  • Joined: 21-June 11

Re: Member function vs global function

Posted 09 December 2012 - 05:54 AM

View PostGardezi, on 09 December 2012 - 01:05 PM, said:

Does global function has more precedence over member function in operator overloading .


No. If there are both a global `operator foo` and a member `operator foo`, the one with the more specific type will be chosen according to the overload resolution rules. If neither is more specific than the other, the program is ill-formed.

View PostAKMafia001, on 09 December 2012 - 01:14 PM, said:

Read this excellent post by Salem_c...


I'm not sure how that addresses the question.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1