How do I call a pointer-to-member-function?

前端 未结 4 1618
南旧
南旧 2020-12-01 15:12

I\'m getting a compile error (MS VS 2008) that I just don\'t understand. After messing with it for many hours, it\'s all blurry and I feel like there\'s something very obvio

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-01 15:33

    p->pfn is a function pointer. You need to use * to make it function. Change to

    (*(p->pfn))(val)
    

提交回复
热议问题