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. C/C++ guru's -- is this possible

C/C++ guru's -- is this possible

Scheduled Pinned Locked Moved C / C++ / MFC
c++
3 Posts 3 Posters 11 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.
  • B Offline
    B Offline
    Brian Anderson
    wrote on last edited by
    #1

    Hi all, is it possible in c/c++ to call a function that is created from variables. .. ex/ CString myFunction myFunction = "SomeFunction()"; i would like to call the contents of myFunction. don't know if its possible, any insight appreciated Brain

    T L 2 Replies Last reply
    0
    • B Brian Anderson

      Hi all, is it possible in c/c++ to call a function that is created from variables. .. ex/ CString myFunction myFunction = "SomeFunction()"; i would like to call the contents of myFunction. don't know if its possible, any insight appreciated Brain

      T Offline
      T Offline
      Tim Deveaux
      wrote on last edited by
      #2

      Possible? Sort of kind of - check out Pete Becker's reply to a similar question at: http://www.cuj.com/archive/1609/qa.html ================== The original message was: Hi all,

      is it possible in c/c++ to call a function that is created from variables. ..

      ex/
      CString myFunction

      myFunction = "SomeFunction()";

      i would like to call the contents of myFunction.
      don't know if its possible, any insight appreciated

      Brain

      1 Reply Last reply
      0
      • B Brian Anderson

        Hi all, is it possible in c/c++ to call a function that is created from variables. .. ex/ CString myFunction myFunction = "SomeFunction()"; i would like to call the contents of myFunction. don't know if its possible, any insight appreciated Brain

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        ================== The original message was: Hi all,

        is it possible in c/c++ to call a function that is created from variables. ..

        ex/
        CString myFunction

        myFunction = "SomeFunction()";

        i would like to call the contents of myFunction.
        don't know if its possible, any insight appreciated

        Brain
        Brian: Yes, this is possible. The function GetGreater will get the greater of the two values passed in... int GetGreater ( int, int ) ; typedef int (*GetGreater) (int, int) ; // this declares a ptr to this function. Then in the code... { PGetGreater pgg; int maxvalue; pgg = GetGreater; if ( pgg ) { maxvalue = pgg ( 5, 3 ) ; } } Or something like that :-) Peter.

        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