08_02.cpp
来自「一些C++的课件和实验源代码」· C++ 代码 · 共 41 行
CPP
41 行
// 08_02.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
class A{
private:
int x;
void f1(){cout << "private function." << endl;}
protected:
int y;
void f2(){cout << "protected function." << endl;}
public:
int z;
void f3(){cout << "public function." << endl;}
};
class B: public A{
public:
void test(){
x = 0;
y = 0;
z = 0;
f1();
f2();
f3();
}
};
int main(int argc, char* argv[])
{
B b;
b.test();
b.f1();
b.f2();
b.f3();
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?