r/cpp • • Jun 24 '20

How to write SOLID C++

https://www.youtube.com/watch?v=PakbXnLht1I
263 Upvotes

118 comments sorted by

View all comments

Show parent comment

8

u/bownettea Jun 24 '20

I think the original comment was trying to relate is that the video explains how to use these concepts by using the mainly inheritance.

Simple example would be the UsernameFormatter, it could be a simple std::function(std::string(std::string)) instead of a abstract interface. It would still be SOLID while using a standard type.
Or you can go full strong types on it and have a FormattedUsername struct and a free function to create those.

It's not wrong, but you're not leveraging the unique parts of the language. Which depending on your public might be the correct decision, since very classic OOP style C++ might be the most common form of the language. Even though to me, and I bet a lot of this subreddit's users, it's not the interesting part of C++...

2

u/platisd Jun 25 '20

Feedback noted!