Example class I'm using:
class Vector
{
double val[3];
public:
double & operator [] (const unsigned int & index) {return this->val[index];};
}
Then I call it like:
Vector Example;
Example[0]=5;
Is using operator overloading like this correct or it is against encapsulation and I should use something different? I'm using reference to private value here and I'm not sure about this implementation.