You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The limitation for a function that can have an explicit object parameter is defined as
An explicit-object-parameter-declaration is a parameter-declaration with a this specifier. An explicit-object-parameter-declaration shall appear only as the first parameter-declaration of a parameter-declaration-list of either:
a member-declarator that declares a member function ([class.mem]), or
a lambda-declarator ([expr.prim.lambda]).
A member-declarator with an explicit-object-parameter-declaration shall not include a ref-qualifier or a cv-qualifier-seq and shall not be declared static or virtual.
Consider a constructor of a class, which satisfies all bullets regulated above. Namely, the constructor can have an explicit object parameter, is this reasonable? Since in the call of a constructor, there never exists an implicit object argument to match the object parameter. From this perspective, a constructor with an explicit object parameter is similar to a non-member function with that object parameter, the latter does make no sense and is forbidden by the above rule.
The text was updated successfully, but these errors were encountered:
The limitation for a function that can have an explicit object parameter is defined as
Consider a constructor of a class, which satisfies all bullets regulated above. Namely, the constructor can have an explicit object parameter, is this reasonable? Since in the call of a constructor, there never exists an implicit object argument to match the object parameter. From this perspective, a constructor with an explicit object parameter is similar to a non-member function with that object parameter, the latter does make no sense and is forbidden by the above rule.
The text was updated successfully, but these errors were encountered: