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. The Lounge
  3. function overload problem:(char) and (char*)

function overload problem:(char) and (char*)

Scheduled Pinned Locked Moved The Lounge
helptutorialquestion
21 Posts 10 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.
  • J jan larsen

    It was a joke, programming questions are to be posted in the programming fora. This is the lounge, people asking programming questions in the lounge will be put in the comfy chair. I will probably regret this, but here is the real answer: When you pass the literal 0 to your function, the compiler will have no way of knowing if it is (char) 0 or (char *) 0. You will have to explicitly type cast it. In the Visual C++ forum you would have had the opportunity to get a better answer from eg. Christian Graus involving standard C++ type casts, I can only offer C style casts :-) : fun((char *) 0) or fun((char) 0). "After all it's just text at the end of the day. - Colin Davies "For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus

    B Offline
    B Offline
    bobi_zcl
    wrote on last edited by
    #21

    I can understand.but I define another two:fun(int) and fun(int*),then I call fun(0),the compiler will compile successfully, and fun(0) will select fun(int) instead of fun(int*).why? thank your suggestion,I will go to the visual C++ forum. your friend:bobi

    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