我在互联网上看到了一些“运营商”类型的代码,并带有一些例子:
//Overloaded operators
int& operator[](int) const; //function type: int& because returns a[i] (or &a[i])
const Vector& operator++();
const Vector& operator--();
const bool operator==(Vector&) const;
Vector& operator=(const Vector&); //COPY ASSIGNMENT - rule of 3
Vector& operator+=(const Vector&); //a Vector, += a vector (since its IN the vector class)
const Vector operator+(const Vector&); //adds values of two equal sized vectors
const Vector& operator+(int); //deals with adding a single int (essentially .pushBack(int))
我希望能够确定知道这个“操作员”功能可以做什么,但搜索它并不容易。
有人知道“运营商”是什么吗?
感谢您的帮助!