Run Code Before Every Function Call for a Class in C++

后端 未结 9 1266
被撕碎了的回忆
被撕碎了的回忆 2021-02-15 13:08

I would like to run some code (perhaps a function) right before every function call for a class and all functions of the classes that inherit from that class. I\'d like to do t

9条回答
  •  鱼传尺愫
    2021-02-15 13:32

    The somewhat inconvenient way where to build a wrapper class that takes an object of your base type and calls the surrounding function and then the function that you wanted to call. This would be something like a decorator.

提交回复
热议问题