I have a class which I intend for others to inherit from. It has a std::vector which I only want developers to be able to read from, but not modify, my base functions modify it. Should I provide a function that returns a const iterator, or expose the vector as protected.
Thanks
If you expose the vector as protected, subclasses will be able to modify it. So, you should expose methods that return const iterators.
You can use the Non-Virtual Interface idiom to expose different interfaces for users and subclasses.