- #include <iostream>
- using namespace std;
- class T
- {
- public:
- int a;
- protected:
- int b;
- private:
- int c;
- };
- class TT : public T
- {
- public:
- void fun(const TT &, const T &);
- int d;
- protected:
- int e;
- private:
- int f;
- };
- void TT::fun(const TT &tt, const T &t)
- {
- int n;
- n = a;
- n = b;
- //n = c;
- n = d;
- n = e;
- n = f;
- n = tt.a;
- n = tt.b;
- //n = tt.c;
- n = tt.d;
- n = tt.e;
- n = tt.f;
- n = t.a;
- //n = t.b;
- //n = t.c;
- }
- int main() {
- return 0;
- }
注释的为编译错误代码。。。
参考:<<c++primer>>第四版