声明同名的 const
和非 const
成员函数属于重载吗?
iterator find ( const key_type& x );
const_iterator find ( const key_type& x ) const;
最佳答案
是的,这是重载。该术语在 [over]/1
中定义为:
When two or more different declarations are specified for a single name in the same scope, that name is said to be overloaded.
在这里,显然有两个同名的不同声明。
关于c++ - 具有 `const` 和非 -`const` 版本的成员函数是否符合重载条件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13410460/