C++ - Private vs. protected access modifier

Use private for your implementation.

Use protected for your public implementation.

Protected members are neither part of your public interface nor part of your encapsulated implementation.
It is implementation that you expose to your subclasses (derived classes).

Use public for your interface.

Ads by Google

Ask a question, send a comment, or report a problem - click here to contact me.

© Richard McGrath