protected members in base class
I have to roll up this topic again, sorry.
In this thread, someone said it would be dubious practice to declare data members 'protected' in a base class.
But what if I have an abstract base class which only describes how child classes should look? Consider a base class Vehicle. All vehicles have an attribute speed. I MUST make that attribute protected, or otherwise a car (which is a vehicle) has no speed. I know you came off with some code showing that it IS dangerous for specific data to make it protected, but when I WANT the data to be inherited (and altered at some point) by derivates, there should be nothing "dubious" bout that. That's what protected is for, isn't it?
- Matthias
"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off." - Bjarne Stroustrup