Thanks for the suggestion Mike,Actually i was searching for the same and but the answer explained there does not satisfied me , as of now thats why i have copied the question from there into this forum can you please explain in brief, why its not public
.
Thanks for the reply Mike,this answer is also considerable but what i think is ,
we cannot have private method(only those declared inside interface) inside class inheriting interfaces is as interfaces are designed as contract and for exposing the properties of the class it inherits to outside world
and if we will make the methods private then those methods will not be accessed by any other class that is completely against the why interface are build................
Member
84 Points
79 Posts
Why must an C# interface method implemented in a class be public?
Jul 07, 2014 02:39 AM|Rohit Binjola|LINK
Why must an C# interface method implemented in a class be public?
I want to know what is the need of this........
Kindly explain the answer with example.........
All-Star
194018 Points
28030 Posts
Moderator
Re: Why must an C# interface method implemented in a class be public?
Jul 07, 2014 02:51 AM|Mikesdotnetting|LINK
Why don't you just read the answer to the question on Stackoverflow where you copied the question from?
Member
84 Points
79 Posts
Re: Why must an C# interface method implemented in a class be public?
Jul 07, 2014 03:13 AM|Rohit Binjola|LINK
Thanks for the suggestion Mike,Actually i was searching for the same and but the answer explained there does not satisfied me , as of now thats why i have copied the question from there into this forum can you please explain in brief, why its not public .
Thanks In Advance..........
All-Star
194018 Points
28030 Posts
Moderator
Re: Why must an C# interface method implemented in a class be public?
Jul 07, 2014 04:03 AM|Mikesdotnetting|LINK
Try this answer instead: http://stackoverflow.com/questions/11162336/why-must-methods-implementing-internal-interfaces-be-public
Member
84 Points
79 Posts
Re: Why must an C# interface method implemented in a class be public?
Jul 07, 2014 04:47 AM|Rohit Binjola|LINK
Thanks for the reply Mike,this answer is also considerable but what i think is ,
we cannot have private method(only those declared inside interface) inside class inheriting interfaces is as interfaces are designed as contract and for exposing the properties of the class it inherits to outside world
and if we will make the methods private then those methods will not be accessed by any other class that is completely against the why interface are build................
All-Star
194018 Points
28030 Posts
Moderator
Re: Why must an C# interface method implemented in a class be public?
Jul 07, 2014 05:42 AM|Mikesdotnetting|LINK
That's pretty much what Jon Skeet said in the second answer.