c++ - 为他人写作

标签 c++ inheritance

当我编写一个将被第三方继承的类时,我必须应用哪些主要和最重要的规则(优点和缺点)。
谢谢。

最佳答案

基本规则是: Make Interfaces Easy to Use Correctly and Hard to Use Incorrectly 。它来自 Scott Meyers 的优秀著作 第 3 版 Effective C++

Here还有一些非常好的类设计指南。

关于c++ - 为他人写作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3022172/

相关文章:

c++ - 为序列重载 ostream << 运算符

c++ - Visual Studio 2010 的全局源代码控制忽略模式中应包含哪些内容?

inheritance - 重写派生类中的静态字段时出现“...不正确地扩展基类静态端”错误

python - super() 在 Python 3 中究竟返回什么?

C++ 继承 : two subclasses of the same class as member variables

c++ - CUDA - 没有 block ,只有未定义维度的线程

python - 在 C++ 中嵌入 python : strange segmentation faults

python - 从继承实例访问本地类变量

java - 让一个类成为几个父类(super class)的子类

c++ - 类公共(public)函数引用私有(private)数组