Like Tree3Likes
  • 2 Post By grumpy
  • 1 Post By laserlight

operator overload doubt

This is a discussion on operator overload doubt within the C++ Programming forums, part of the General Programming Boards category; which operators below can be overloaded as class member and non meber function in c++ ? 1) + 2) () ...

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    162

    Thumbs up operator overload doubt

    which operators below can be overloaded as class member and non meber function in c++ ?
    1) +
    2) ()
    3) []

  2. #2
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,635
    All of them.

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    6,207
    Virtually all decent introductory material about C++ deals with this - and with most of the questions you've started threads for.

    Since you clearly expect other people to do the hard work of learning and thinking for you, welcome to my ignore list.
    ZuK and antred like this.
    Right 98% of the time, and don't care about the other 3%.

  4. #4
    ZuK
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Quote Originally Posted by grumpy View Post
    Since you clearly expect other people to do the hard work of learning and thinking for you, welcome to my ignore list.
    Nah. He's just testing us.
    Kurt

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,436
    whiteflags failed the test though: none of them "can be overloaded as (...) non meber function".
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,635
    I somehow forgot that friends count as members of the client class. Not that they have to be friends.

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,436
    Heh, I'm just playing with a typo.
    whiteflags likes this.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help with overload operator[]
    By effa in forum C++ Programming
    Replies: 8
    Last Post: 10-09-2009, 06:30 AM
  2. operator overload
    By maxcat in forum C++ Programming
    Replies: 2
    Last Post: 03-17-2008, 05:07 AM
  3. Operator overload
    By Gordon in forum C++ Programming
    Replies: 3
    Last Post: 03-11-2008, 01:20 PM
  4. overload operator<
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 12-12-2001, 02:54 PM
  5. how to overload [] operator?
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 10-19-2001, 09:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21