   Use case for inheritance with non-default constructor?
  I've been going around and around in my head today trying to think of a case where you need a non-default constructor (really, the invariants of the class need some initial state and it has no sane default) and you want to inherit from that class.Most of the cases I can think of don't really meet that second criteria where you need to inherit the behavior of the class. file is probably the best/closest I could think of. You want the non-default constructor because a file object that points to nothing is perhaps a little silly (or at least annoying to work with). But you never really want to inherit from it. You either want to inherit from some common interface that file satisfies (ie: StreamWriter), or build the new class with a file object and re-expose some functionality.I know I've not seen a whole ton of code yet, so what have I missed or overlooked? What is a good compelling use case for this?   
  I have some cases like the following:class Simulation {};class Entity{public:  Entity( Simulation& p ) : m_Parent(p) {}private:  Simulation& m_Parent;};class Derived : public Entity{public:  Derived( Simulation& p, int foo ) : Entity(p) { Foo(foo); }};If you don't like this, you could of course get around it by using pointers + a SetParent function, but I prefer this way.   ;  Yeah, some sort of SetParent/SetSimulation there would be awkward.   ;  There are some CRTP and other implementation helper classes that require the use non-default constructors in order to do the job of being basically code generators. For example, in AngelScript if you want to use a script object (represented by an asIScriptObject pointer) as a C++ object you need to write a lot of boiler plate code that wraps the calling of script functions. Since it's mostly the same from class to class, you can factor out a lot of this code and wrap in in templates, and since every type would require an asIScriptObject pointer and it doesn't make sense to create one with a null pointer, that base class with all the helper templates wouldn't use a default constructor.   