r/cpp • u/victor-s8n • 26d ago
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
r/cpp • u/victor-s8n • 26d ago
This is my first ever blog-post, any feedback is welcome! ofc, no AI got used.
View all comments
13
u/decapod2005 26d ago
Idk about pimpl idiom in 2026. Sure it's good for trading runtime for compile time performance (among other things), but when people reach for C++, they are usually interested in trading in the opposite direction. It's certainly a useful technique to know, but it should never be the default way how you write classes.
This is one of the weirdest statements that I still see made with some frequency. It implies two pretty wild claims:
Neither of these are true. Just come up with a proper test that doesn't require the function to be virtual.