Protected visibility modifier to a method or datamember in a base class is used to control access to these methods either by objects belonging to the base class or objects of the class derived from the base class.
It prevents other objects from accessing these protected datamembers or methods.
----------------
explanation
----------------
Assume we have a class A from which we derive a class B and from B we derive classC.
Also assume that we have a separate class D unconnected to A, B or C
If you define a method or a datamember of class A as protected, you ensure that these datamembers or methods can be accessed by objects belonging to classA or ClassB or class C. and not by D.
If you declare a method in class A as public, then this method can be accessed by objects of A or B or C or D.
If you declare a method in class A as private, then only when you are inside class A, you will be able to access it. Objects of B,C,D cannot access it.