#include <iostream>
using namespace std;
namespace Test{
class A{
public:
friend void TestFn1(const A &a){};
};
void TestFn2(const A &a){};
}
class B{
public:
operator Test::A(){return Test::A();}
};
using namespace Test;
void TestFn3(const A &a){}
void main(){
B obj;
TestFn1(obj);
TestFn2(obj);//不需要通过对象调用,因为有using namespace Test;
TestFn3(obj);
}
问题What does “operator Test::A()” mean? TestFn1(obj) can’t get through the compiling,but TestFn2(obj) and TestFn3(obj) can,why? |