some questions on classes
okay, first of all...I've read that in a well designed class, none of the data members should be public, all data should be accessed through member functions. However, I think I'm about to be designing some classes with a lot of data members that will need to be both read and changed from outside the class. I'm a demon for speed in my code, and if I can have small code that is also fast, that's just great. My questions are as follows: First, is there an advantage to having a member function in the class to return the value of a data member, and another to change it, over simply having the data member public? Also, does the overhead involved in calling a function apply to member functions in classes? I assume it does, and if so, wouldn't it be slower to have functions to access the data than to just make the data public?