[Solved] Why doesnt vector support size as member variable like length variable in a Java class, instead a function size()? [closed]
Why doesn’t std::vector or other containers have length as a member variable, instead of a function? Because it would be writable if it was a public member variable. Since it makes no sense to write to the size member of a vector, the designers made the size member private and provided a size() method to … Read more