Whether private,protected method can be overloaded,overrided or not?Tell me reason?

Showing Answers 1 - 3 of 3 Answers

Devidas Sonawane

  • Oct 28th, 2005
 

We can use access specifier's and we can overload the methods also. but we can't override methods( by changing only access specifier is just like a override.)

  Was this answer useful?  Yes

Sarje

  • Aug 12th, 2009
 

Private protected methods can be overloaded and overrided. But while overrding method following rules must be satisfied
We can not narrow the accessibility but can be widen. Means if the access specifier is suppose protected then you can keep it protected or make it public but cannot make it private.

  Was this answer useful?  Yes

uncer

  • Jan 15th, 2010
 

A Private Protected Methods can be overloaded but in the concept of overriding access modifier should not be restricted
mean:
If a method in superclass is public then overrided method in subclass must be public
If a method in superclass is protected then overrided method in subclass must be protected or public
If a method in superclass is package then overrided method in subclass must be protected, protected or public.

Regards
Shahid Khan Abbasi
lahore
pakistan

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions