Consider relevant issues when determining whether to use
protected or private members in a base class. Are there any
risks involved with using the protected
member access specifier instead of the private member access
specifier?
Private: if you declare any variable/method as Private than you can't access the variable/method outside of that class. So strictly variable/method is available only with in the class.
Protected: if you declare any variable/method as Protected than we can access variable/method with in the class as well and in all its child classes
So if you want variable/method should available with in the class than you should use Private. if you want share the variable/method to its child classes than you should use Protected
There is no risk as it is available only for its child classes
Note : If you like my answer please rate and help me it is very Imp for me
Get Answers For Free
Most questions answered within 1 hours.