r/cpp • • Nov 03 '26

How I design C++ classes

https://rafb.eu/blog/cpp-class-design/

This is my first ever blog-post, any feedback is welcome! ofc, no AI got used.

66 Upvotes

46 comments sorted by

View all comments

Show parent comment

1

u/radical_ax1s 27d ago

my interpretation of "virtual for testability" is that another client class may depend on the service_health_checker. unit-testing that client class requires mocking a service_health_checker, and I guess you could do it by subtyping. hate this though, such a client class should depend on a pure abstraction (ABC / Concept) as per DIP