#include <iostream>
class Base
{
private:
int num;
public:
Base(int tmp = 0) : num(tmp) {}
const Base& operator=(const Base& tmp)
{
num = tmp.num;//why tmp can use num?
return *this;
}
};
int main()
{
return 0;
}
details: num is private, so I think tmp can't access it.But why this code can be compiled successfully?