#include<iostream>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<string.h>
#include<stdlib.h>
#include<sstream>
using namespace std;
class two;
class one{
private :
string name;
public :
void show(two &);
void setOne(){
string s;
name = s;
}
};
class two{
private :
string name;
public :
friend void one::show(two &);
void setTwo(){
string s;
name = s;
}
};
void one :: show(two &s){
cout << s.name << endl; //编译器报错,无法访问name,这是为什么?
}
int main()
{
one a;
two b;
a.setOne();
a.show(b);
b.setTwo();
return 0;
}
onemoo
onemoo
相关分类