一个函数重载问题

今天下午在看c++ primer plus时遇到一个疑问

请教个问题,一个类的2个类方法声明为

为什么没有产生重定义错误?

double & operator[](int i);
double operator[](int i) const;


比如

class Student 
{
....
public:
double & operator[](int i);
double operator[](int i) const;
...
};


student ada[3];


ada[1] = ada[3];

会不会产生二义性?
不明白,,,,,,,,

经过网络提问,总结之后得出答案

double & operator[](int i);相当于friend double operator[](Student *this,int i);
double operator[](int i) const;相当于friend double operator[](const Student * const thisint i);


不能忽略调用的隐式参数,自身!

原文地址:https://www.cnblogs.com/zero5/p/3423106.html