#include <iostream>
#include "string"
using namespace std;
class Screen;//不是有前声明Screen么
class Cursor
{
public:
typedef string::size_type index;
void relocate(index, index, Screen& C);//主要这里的Screen
};
class Screen
{
public:
Screen(const string &b):name(b){}
private:
friend class Cursor;
string name;
};
void Cursor::relocate(index,index,Screen&C)
{
cout << C.name << endl;
}
int main()
{
Cursor A;
Screen B("HAHA");
A.relocate(1,1,B);
system("PAUSE");
return 0;
}