locked
why we get compiler error when we put public in front of methods in an Interface? RRS feed

  • Question

  • User332559773 posted

    can someone suggest why we get compiler error when we put public in front of methods in an Interface? 

    Thursday, December 13, 2007 10:06 AM

Answers

  • User2089715135 posted

    because its not legal!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 13, 2007 10:13 AM
  • User535736832 posted

    All the member declarations inside interface are implicitly public. So there is no need to specify public keyword for any method inside interface
    you will find more detail about interface at http://www.codersource.net/csharp_tutorial_interface.html

    hope it answer your question

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 13, 2007 10:26 AM

All replies

  • User2089715135 posted

    because its not legal!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 13, 2007 10:13 AM
  • User535736832 posted

    All the member declarations inside interface are implicitly public. So there is no need to specify public keyword for any method inside interface
    you will find more detail about interface at http://www.codersource.net/csharp_tutorial_interface.html

    hope it answer your question

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 13, 2007 10:26 AM