Sko*_*ler 2 c++ standards function
为什么在c ++标准(我看cpp参考站点)中允许两个具有相同签名的变体?
例如:
reference front();
const_reference front() const;
Run Code Online (Sandbox Code Playgroud)
尾随const
是签名的一部分.假装隐含this
是明确的:
reference front( This *this);
const_reference front(const This *this);
Run Code Online (Sandbox Code Playgroud)
显然,参数列表是不同的.