c++ callback for events

Discussion in 'C++' started by amanpoonia, Dec 30, 2011.

  1. amanpoonia

    amanpoonia New Member

    Joined:
    Dec 30, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Pune,India
    how can we implement callback..
    Suppose we have two classes student and display and we will call display only when the marks of students have changed using function pointers.
    we can increase number of student .we can add marks for particular student keeping it in while loop
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Moved to C++ forum
     
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    One of the aims of OOP is to eliminate the need for unsafe practices like calling function pointers. Do the design properly and you won't need to use function pointers for this - you can just call the display routine on a change, using the display object directly.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice