Yes you can, but this is a very bad template to enter.
struct foo { }; foo foo(foo& f) { return f; } int main() { struct foo f; foo(f); return 0; }
See liveemo: http://ideone.com/kRK19f
The trick was to tell struct foo when we wanted to get this type. Note that until you create this ambiguity, you really don't need to keep saying struct , it's not C (as in the line foo foo(foo& f) ).
Most developers choose a camel shell pattern, for example, use an uppercase letter to indicate type names and a lowercase letter for the function name:
struct Foo { }; Foo foo();
Back in Microsoft Prime, many Windows developers have acquired the habit of struct / class definition prefix, class definition of things, if you like, with capital C
struct CFoo { };
Now, even if you want to use the upper letters of the first line for the names of your functions, there is no ambiguity.
kfsone
source share