I'm doing a little clean up and in my never ending learning experience. I'm back at that good 'ol question. How many accessor functions are too much for an object? I noticed I tend to have alot of classes were the data they encapsulate is actually public, simply for the fact that I don't want to right a bunch of functions just to be able to see what the values of that data are. I try my best to stay away from, changing the data from the outside without using a function specifically for changing that data.... but alot of the data needs to be visible to outsiders.
...
so in a case like this, and I know this is pretty small, but would it be good practice to leave them public or would you setup a series of get functions like so??
Neither one is "bad". You are just choosing between different tools. Sometimes you need a knife other times a hammer; neither is bad.
You create whatever is needed to make the program.
You should decide up front what kind of object you will have.
You can have plain old data objects, such as a point or a vector or a matrix or some other fixed-form data. There is no reason to make the user go through accessors and mutators for that type of object. The class can still have functions, like ComputeEignevalue, but they don't need to run on private data in the class.
You can also have more complex class objects, such as your really bad car engine example. In that case, you almost never want direct access, and will tend to use accessor and mutator functions. You send it commands and events, and you request information. You ask the engine about it's RPMs, you (almost) never force your way inside the engine and measure the thing yourself.
What is your specific class you are talking about? Is it a plain-old-data container class that anyone can modify, or is it a complex class that you don't want people to touch the innards of? Is this an object where data can be modified with impunity, or where you need choke points to identify and handle and validate every time data is modified?