#include
using namespace std;
class CLIENT
{
public:
CLIENT(char name,int num)
{
ServerName=name;
ClientNum=num;
}
~CLIENT() {}
void showServerName() {cout<<"服務器名稱為:"<<'name'<<endl;}
void showClientNum() {cout<<"已定義的客戶數量為:"<<num<<endl;}
void showChangeServerName();
private:
static char ServerName;
static int ClientNum;
};
void showChangeServerName(char Cname)
{
ChangeServerName=Cname;
cout<<"服務器名稱改變為:"<<'name'<<endl;
}
char ServerName='I';
int ClientNum=7;
void main()
{
CLIENT n();
n.showClientNum();
CLIENT c();
c.showChangeServerName();
}
#include<iostream>
using namespace std;
class CLIENT
{
public:
CLIENT(char name,int num)
{
ServerName=name;
ClientNum=num;
}
~CLIENT() {}
void showServerName() {cout<<"服務器名稱為:"<<ServerName<<endl;}
void showClientNum() {cout<<"已定義的客戶數量為:"<<ClientNum<<endl;}
void showChangeServerName(char Cname);
private:
static char ServerName;
static int ClientNum;
};
void CLIENT::showChangeServerName(char Cname)
{
ServerName=Cname;
cout<<"服務器名稱改變為:"<<Cname<<endl;
}
int main()
{
CLIENT n('I', 7);
n.showClientNum();
CLIENT c('I', 7);
c.showChangeServerName('A');
}