Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. operator overloading problem.......

operator overloading problem.......

Scheduled Pinned Locked Moved C / C++ / MFC
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gateway23
    wrote on last edited by
    #1

    sir/mam can you please tell me if there is any particular reason why the following operators can't be oveloaded.. . :: ?:

    N J 2 Replies Last reply
    0
    • G gateway23

      sir/mam can you please tell me if there is any particular reason why the following operators can't be oveloaded.. . :: ?:

      N Offline
      N Offline
      Niklas L
      wrote on last edited by
      #2

      You can read what the inventor of the language, Bjarne Stroustrup, thinks about this right here[^]. No-one can give you a better explanation than him.

      S 1 Reply Last reply
      0
      • G gateway23

        sir/mam can you please tell me if there is any particular reason why the following operators can't be oveloaded.. . :: ?:

        J Offline
        J Offline
        JanakiramanElumalai
        wrote on last edited by
        #3

        The mentioned operators are used for only one purpose. Example in c++ the '.' operator used only for accessing member functions. (so there is no use of overloading '.' ) . :: ?: But the symbols (+,- and etc..) are used to add numbers and objects . Ex: By default '+' operators are used for adding the numbers only and not the objects (we are overloading the '+' operator to add the objects ) In c++ operator overloading takes the meaning as below Operator Overloading: customize the operator to do other operations also(other than default operation). clear?

        1 Reply Last reply
        0
        • N Niklas L

          You can read what the inventor of the language, Bjarne Stroustrup, thinks about this right here[^]. No-one can give you a better explanation than him.

          S Offline
          S Offline
          Stefan_Lang
          wrote on last edited by
          #4

          Great link! The explanations are even better than those found in Stroustrup's 'The C++ Programming Language' (that's what I checked, I was especially curious about :? and am somewhat disappointed that there isn't even a good reason against overloading it. I could think of a good use or two...)

          N 1 Reply Last reply
          0
          • S Stefan_Lang

            Great link! The explanations are even better than those found in Stroustrup's 'The C++ Programming Language' (that's what I checked, I was especially curious about :? and am somewhat disappointed that there isn't even a good reason against overloading it. I could think of a good use or two...)

            N Offline
            N Offline
            Niklas L
            wrote on last edited by
            #5

            The entire page is a good resource. In the next version of the standard I'm looking forward to see overloading of the new operators: ; - ) and : - P

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups