What does operator void* () mean?

c++

Solution

No they are two different operators. The `operator void*` function is a type casting function, while `operator()` is a function call operator.

The first is used when you want to convert an instance of `Foo` to a `void*`, like e.g.

Foo foo;
void* ptr = foo;  // The compiler will call `operator void*` here

The second is used as a function:

Foo foo;
void* ptr = foo();  // The compiler calls `operator()` here

Problem

I googled, but didn't find a clear answer. Example: ``` class Foo { public: operator void* () { return ptr; } private: void *ptr; }; ``` I understand what `void* operator()` is. Is the above operator the same thing in a different syntax? If not, what is it? And how can I use that operator to get the `ptr`?

Original source