Exception member class OOP
Exception member class OOP I have met the following concept in the production code: class A { public: class Exception : public std::exception {/* ... */}; //... }; Nobody can give me a clear answer why it is like this. My question is whether this approach is in line with SOLID rules? I think that would be better if this exception class is located outside the class A and is injected while creating the instance of A. Design principles are important, but they aren't followed "because they are design principles". They are followed because they accomplish something. What would injecting the exception object upon construction accomplish? Now the class should manage this objects lifetime. What if an error state is never encountered, and it's never thrown? – StoryTeller Jul 2 at 6:16 ...