public :公开的公共的
private:私有的,只能在当前类的内部访问
protected:受保护的,只能在当前类的内部以及该类的子类中访问。
internal:只能在当前项目中访问。在同一个项目中,internal和public的权限是一样。
protected internal:protected+internal
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _02访问修饰符
- {
- class Program
- {
- static void Main(string[] args)
- {
- Person p = new Person();
- }
- }
- public class Person
- {
- //protected string _name;
- //public int _age;
- //private char _gender;
- //internal int _chinese;
- //protected internal int _math;
- }
- public class Student : Person
- {
- }
- //public class Student:Person
- //{
- //}
- }