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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. function pointers...

function pointers...

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
2 Posts 2 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.
  • M Offline
    M Offline
    misterbear
    wrote on last edited by
    #1

    I need to store function pointers with same return type and arguments, but from different classes, in a stl map, like this: void(classA::*)(istringstream&) and void(classB::*)(istringstream&) in the same map (in another class, classC). is this possible? If so, how is it done?

    N 1 Reply Last reply
    0
    • M misterbear

      I need to store function pointers with same return type and arguments, but from different classes, in a stl map, like this: void(classA::*)(istringstream&) and void(classB::*)(istringstream&) in the same map (in another class, classC). is this possible? If so, how is it done?

      N Offline
      N Offline
      Neville Franks
      wrote on last edited by
      #2

      You may find this article http://www.codeproject.com/useritems/polycontainer.asp[^] of help. If you need to call these functions in specific class instances then you will need to hang on to their 'this' pointer or use something like delegates: http://www.codeproject.com/cpp/FastDelegate.asp[^] I can't see why you'd want to store function pointers in a map though! Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com

      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