At my workplace, usually default parameters are specified in the declaration.What is the normal custom? Should I specify default parameters in method declaration or method definition?
EDIT: Is there any way to specify default parameters for references?
EDIT: Can someone please provide an example of default arguments for reference parameters?
ybungalobill has already answered the question about where.
Regarding references, for a reference to
constT you can just specify a default value directly.For a reference to non-
constyou need to specify the default “value” as a reference to non-const. This might be a global, or an instance of a class with suitable conversion. E.g.,Cheers & hth.,
– Alf