C++相談室 part41
■ このスレッドは過去ログ倉庫に格納されています
0742デフォルトの名無しさん
2005/08/07(日) 05:13:56{
A* hello()
{
std;;cout _<< "Hello" << std::endl;
}
A* operator->()
{
std::cout << "A::oprator->()" << std::endl;
return this;
}
A* operator[](const std::string& s)
{
std::cout << "A::operator[]()" << std::endl;
return this;
}
A* operator()()
{
std::cout << "A::operator()()" << std::endl;
return this;
}
};
int main()
{
A a;
a->hello() //OK
a->(); //error
a->["hello"]; //error
}
operator->でA*を返してるはずなのにエラーになったりならなかったり
どういうことでしょうか? vc7.1です
■ このスレッドは過去ログ倉庫に格納されています