C++继承public protected private的区别
继承关系
这里直接上一张菜鸟教程的图
这个图的关系很明确,但是我觉得初学者更重要的是知道哪些是外部类,派生类和同一个类
代码
class A
{
public:
void father_public()
{
cout << "A::father_public() is called" << endl;
}
protected:
void father_protected()
{
cout << "A::father_protected() is ca
原创
2021-07-07 11:34:13 ·
159 阅读 ·
1 评论