【发布时间】:2010-01-25 19:22:16
【问题描述】:
假设我在一个类中声明了下标运算符
char& operator[] (int index);const char operator[](int index) const;
在什么条件下调用第二个重载。是否仅通过const object 调用。
在以下场景中将调用哪个版本的运算符。
const char res1 = nonConstObject[10];
nonConstObject[10];
【问题讨论】:
标签: c++ operator-overloading constants