Line 2 declares a member variable which is a pointer to a function which takes a single argument of type Arg and returns a value of type Result. The syntax is a bit weird, but I suppose it's consistent with other declarations.
explicit is a keyword for constructors. Consider this class:
1 2 3 4 5 6
struct Foo{
...
Foo(int x) {
...
}
};
Now in your main you could write Foo f = 5;. This is an implicit call to the constructor. If you declare the c-tor explicit, you must use Foo f(5); syntax.
4. Result(*pfunc)(Arg); also this kind of variable declaration is hard-to-understand for me :(
Start in the middle.
pfunc is a.... (look left)
pointer to a function that... (look right)
takes a single parameter, of type Arg, and... (look left)
returns an object of type Result.
If pfunc is a function pointer, the syntax to call it is (*pfunc)(arguments).
main() is a function. You could write void (*ptr)() = main; but that doesn't make it a pointer, the same way that array isn't a pointer.
C++ implicitly considers every use of a function that it's not call to be address assigning (some pointer is taking the function address). Its similar to the way the name of an array gives a pointer to the first element of the array.
So if type matches you can do:
1 2
int (*fp)(); //meaning fp is a pointer to a function returning int and having void argument
fp = main;
The second one I think it's legal (syntactically I mean) but it's not recommended. The "correct" form would have been: fp = &main; which has exactly the same result.
As far as I know main() should not be called or be called, so you can do it with other functions also.
int(*fp)() and int(*fp)(int) and etc. all point to different types of functions.
Why do you keep insisting that a function is a pointer. Can you apply () to pointers? In reality a function is a section of code stored in memory, so you could call it an object and it is perfectly natural to be able to have a pointer to it, but you never get to manipulate it like an object. If you want your functions to be objects, learn Haskell.