I have a vector as member in a class and I want to return a reference to it through a getVector() function, so as to be able to modify it later. Isn’t it better practice the fun
The reason is that a const member function should only return const references. This is because in a const function, every data member becomes constant.
Therefore you have to declare the getVector() this way: