摘要: 有两种方式可以实现多态公有继承 1) 在派生类中重新定义基类的方法 2) 使用虚方法 如下是 使用虚方法 brass.h main.cpp include include "brass.h" using namespace std; //formatting stuff typedef std::i 阅读全文
posted @ 2018-09-11 15:18 尚修能的技术博客 阅读(256) 评论(0) 推荐(0)
摘要: 实现多态共有继承的两种方法 1 在派生类中重新定义基类的方法 2 使用虚方法 P493程序清单13.7使用的方法为 在派生类中重新定义基类的方法 brass.h main.cpp include include "brass.h" using namespace std; //formatting 阅读全文
posted @ 2018-09-11 11:15 尚修能的技术博客 阅读(269) 评论(0) 推荐(0)