Function declaration
From cppreference.com
A function declaration introduces the function name and its type. A function definition associates the function name/type with the function body.
Contents |
[edit] Function declaration
Function declarations may appear in any scope. A function declaration at class scope introduces a class member function (unless the friend specifier is used), see member functions and friend functions for details.
noptr-declarator ( parameter-list ) cv (optional) ref (optional) except (optional) attr (optional)
|
(1) | ||||||||
noptr-declarator ( parameter-list ) cv (optional) ref (optional) except (optional) attr (optional)-> trailing
|
(2) | (since C++11) | |||||||
(see Declarations for the other forms of the declarator syntax)
1) Regular function declarator syntax.
2) Trailing return type declaration. The decl-specifier-seq in this case must contain the keyword auto.
noptr-declarator | - | any valid declarator, but if it begins with * , & , or && , it has to be surrounded by parentheses.
| |
parameter-list | - | possibly empty, comma-separated list of the function parameters (see below for details) | |
attr | - | (since C++11) a list of attributes. These attributes are applied to the type of the function, not the function itself. The attributes for the function appear after the identifier within the declarator and are combined with the attributes that appear in the beginning of the declaration, if any. | |
cv | - | const/volatile qualification, only allowed in non-static member function declarations | |
ref | - | (since C++11) ref-qualification, only allowed in non-static member function declarations | |
except | - | |