In C#, what is the difference between public, private, protected, and having no access modifier?

前端 未结 16 2762
盖世英雄少女心
盖世英雄少女心 2020-11-22 01:12

All my college years I have been using public, and would like to know the difference between public, private, and protected

16条回答
  •  名媛妹妹
    2020-11-22 02:05

    A status of Private indicates that variables can only be accessed by objects of the same class. Protected status extends that access to include descendants of the class as well.

    "from the above table we can see the deference between private and protected... am think both are same ....so what the need for that two separate command"

    Check MSDN link for more information

提交回复
热议问题