ex020202.cpp
来自「深入浅出Visual C++入门进阶与应用实例 随书光盘 作者 何志丹」· C++ 代码 · 共 75 行
CPP
75 行
// Ex020202.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
class A1
{
public :
int x1 ;
protected:
int y1 ;
};
class A2
{
public :
int x2 ;
protected:
int y2 ;
};
class A3
{
public :
int x3 ;
protected:
int y3 ;
};
class A : public A1 ,protected A2 , private A3
{
public:
A();
};
class B : public A
{
public:
B();
};
A::A()
{
y1 ;//保护级或私有
x2 ;//保护级或私有
y2 ;//保护级或私有
x3 ;//保护级或私有
y3 ;//保护级或私有
}
B::B()
{
y1 ;
x2 ;
y2 ;
//x3 ;x3没有被继承,说明在B中私有的
//y3; y3没有被继承,说明在B中私有的
}
int main(int argc, char* argv[])
{
A a ;
a.x1 ;
//a.y1 ; y1不是保护级成员
//a.x2 ; x2不是保护级成员
//a.y2 ; y2不是保护级成员
//a.x3 ; x3不是保护级成员
//a.y3 ; y3不是保护级成员
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?