A: Mostly can be overloaded. The only C operators which can't be are. and?: (and sizeof, that is technically an operator). C++ adds a few of its own operators, mostly which can be overloaded except :: and .*.
Here's an instance of the subscript operator (it returns a reference). Primary without operator overloading:
class Array {
public:
int& elem(unsigned i) { if (i > 99) error(); return data[i]; }
private:
int data[100];
};
int main()
{
Array a; a.elem(10) = 42; a.elem(12) += a.elem(13);
...
}
Now the similar logic is presented along with operator overloading:
class Array {
public:
int& operator[] (unsigned i) { if (i > 99) error(); return data[i]; }
private:
int data[100];
};
int main()
{
Array a; a[10] = 42; a[12] += a[13];
...
}