摘要: Consider: class B { public: void mf(); // ... }; class D : public B { /*...*/ }; D x; // x is an object of type D B *pB = &x; // get pointer to x pB-> 阅读全文
posted @ 2021-09-28 20:49 MyCPlusPlus 阅读(28) 评论(0) 推荐(0) 编辑
摘要: The Template Method Pattern via the Non-Virtual Interface Idiom: class GameCharacter { public: int healthValue() const // derived classes do not redef 阅读全文
posted @ 2021-09-28 20:34 MyCPlusPlus 阅读(104) 评论(0) 推荐(0) 编辑
摘要: The seemingly straightforward notion of (public) inheritance turns out, upon closer examination, to be composed of two separable parts: inheritance of 阅读全文
posted @ 2021-09-28 11:35 MyCPlusPlus 阅读(38) 评论(0) 推荐(0) 编辑