Discuss the relative merits of using protected access vs. using private access in base classes?
- husoskiLv 72 years agoFavorite Answer
The comparison should be protected vs. public, not protected vs. private. "Protected" is a limited version of "public", exposing a method or field to other classes, but not all of them.
Using protected to allow a "back door" access to what would normally be private is *not* object-oriented. It exposes object state to a using class, which breaks encapsulation.
- harpertaraLv 72 years ago
Sorry, not doing your homework for you.