Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 20
    In case you try "class foo()" and it fails: In ISO C++, "class foo()" is an illegal construct (the article was written '97, before standardization, it seems). You can put "typedef class foo foo;" into main, then you can say "foo();" (because then, the typedef-name is lexically closer than the function's name). Syntactically, in T(), T must be a simple-type-specifier. elaborated type specifiers are not allowed. Still this is a good answer, of course. Commented Jul 5, 2009 at 21:36
  • Listing 1 and Listing 2 links are broken. Have a look. Commented Oct 13, 2010 at 17:05
  • 7
    If you use different naming conventions for classes and functions, you also avoid the naming conflict without needing to add extra typedefs. Commented May 9, 2017 at 16:34
  • 1
    One place where this occurs in 'real life' is with the POSIX function stat(). The function name is stat(); the second argument is a struct stat pointer. Commented Nov 24, 2024 at 16:59