I found this code:
#define mockable virtual
Do you have any idea why somebody will define virtual like this? I’m just curios what’s the point of doing this
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
So that you could do:
And then define mockable as virtual for the test build so that you can override that method inheriting from the class.
You write your test and use a class that inherits from ClassIdLikeToTest and overrides mymethod, and it will work as long as mockable is virtual, but then you can remove it for production builds and those functions will not be virtual, and you don’t pay for the virtual call.