Generally, if you define a member variable of a class, this variable should only be accessed by member functions of that class (or derived class). This is true both for static and non-static member variables. If you need to read or change them from outside the class, define accessor member functions as needed. Any static or non-static function can and may access any member variable. Therefore there is no need to pass it to such a function, unless it is a non-static member variable of a different instance of the class. Example:
class Vector3i {
private:
std::array data;
public:
// example 1: change own member variable
void fill(const int value) {
data.fill(value);
}
// example 2: change member variable from another instance
void swap(Vector3i& other) {
std::swap(data, other.data);
}
};
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)