<code>
#include<iostream>
#include<iomanip>
using namespace std;
int q=10;
class pooh{
private:
public:
int a;
pooh(int i)
{
a=i;
}
virtual void v()
{
cout << a;
}
friend void operator = (pooh & h1,pooh & h2)
{
h1.a = h2.a;
}
};
int main()
{
pooh e(11);
pooh e1(55);
e = e1;
e.v();
return 0;
}
</code>
이렇게 컴파일을 하면
Compiling...
Cpp1.cpp
C:\Djgpp\Study\Cpp1.cpp(22) : error C2801: 'operator =' must be a <Unknown> member
C:\Djgpp\Study\Cpp1.cpp(23) : error C2143: syntax error : missing ';' before '.'