Policy based design and best practices – C++
Here’s how I would implement the class: template<class PenType> class Writer { public: Writer(const PenType& pen = PenType()) : pen(pen) {} void StartWriting() { pen.Write(); } private: PenType pen; }; This allows the user to pass a specific Pen object to the constructor, if it either doesn’t have a default constructor, or you don’t want … Read more