?? 5-3-1.cpp
字號:
#include <iostream.h>
class X {
private:
int x;
static int y;
public:
void Set(int i){
x=i;
}
void Display(){
cout<<"x="<<x<<",y="<<y<<endl;
}
friend class Y;
};
class Y {
private:
X a;
public:
Y(int i, int j);
void Display();
};
int X::y = 10;
Y::Y(int i, int j)
{
a.x = i;
X::y=j;
}
void Y::Display()
{
cout<<"x="<<a.x<<", y="<<X::y<<endl;
}
void main()
{ X b;
b.Set(15);
b.Display();
Y c(16, 19);
c.Display();
b.Display();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -