Operator, który jest wskaźnik do funkcji
Poniższy przykład działa w programie Visual C++.NET 2003, jak określono w normie:
// operator_that_is_pointer_to_function.cpp
// function style call on object will invoke user-defined conversion
// if there is one. See secion 13.3.1.1.2
typedef void(*ptf)();
void func()
{
}
struct S
{
operator ptf()
{
return func;
}
};
int main()
{
S s;
s();//operates as s.operator ptf()()
}