I guess it's a simple question, at least I can't think in any example. standard:
Two declarations correspond if they (re)introduce the same name, both declare constructors, or both declare destructors, unless...
So. If I understood correctly, if I have two classes A and B, two constructors A() and B(), they correspond? maybe I'm not considering the unless. But what would be such a example in which declarations correspond without having the same name?
The stuff after "unless" is rather important. In particular, this:
- each declares a function or function template, except when:
- both declare functions with the same non-object-parameter-type-list,18 equivalent ([temp.over.link]) trailing requires-clauses (if any, except as specified in [temp.friend]), and, if both are non-static members, they have corresponding object parameters, or...
Even "corresponding object parameters" has a definition which is slightly above the above paragraph. It includes the text, "their object parameters have the same type."
Constructors and destructors cannot ahve explicit object parameter types. Therefore, their object parameter types are implicit and have "object parameter" types formed from the type of the class they're a member of. So constructors/destructors of different classes have different object parameter types, so their object parameter types do not "correspond", and therefore, this is an exception to the "each declares a function", which means that they these declarations do not "correspond".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With