Why can't we specify the accessibility modifier for methods inside the interface ?
Loading
Why can't we specify the accessibility modifier for methods inside the interface ?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Andrew FensterPosted Mar 17, 2011, 8:27 AM
If you want to specify private or protected methods, you need to create a base class instead.
Honestly, this is a very important topic for you to understand. If you want to make your living as a programmer, it's something you absolutely must master. You should get a book and spend several hours studying the subject. Then go over it again next week and again next month and again the month after that, etc. You can't get it by asking questions on a forum.
VulpesPosted Mar 17, 2011, 5:46 AM
Krishna GaradPosted Mar 17, 2011, 5:20 AM
Interface is only set of rule if we are applying any accessibility on the rules then why to implement the interface. Who want the restriction on there own they may implement that interface and who dont want they will not implement that interface. That's the reason we can't specify accessibility modifier for methods or any other member of inside the interface.
Interface contain only decleration not Defination. Whatever defenation we are giving that in the classes who are implement that interface.