C#中有关字段的访问控制
来源:互联网 发布:有线通 知乎 编辑:程序博客网 时间:2024/05/22 13:55
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace fieldDemo{ class Employee { public readonly int id; public string name; public int age = 20; public const int minAge = 18; public static string company; public void display() { Console.WriteLine("name:{0}, age:{1}, company:{2}",name,age,company); } } class Program { static void Main(string[] args) { Employee.company = "ldu"; Employee emp1 = new Employee(); emp1.name = "zxf"; emp1.age = 25; if (emp1.age < Employee.minAge) Console.WriteLine("不符合要求"); else Console.WriteLine("name:{0}, age:{1}, company:{2}",emp1.name,emp1.age, Employee.company); Employee emp2 = new Employee(); emp2.display(); Console.ReadLine(); } }}
0 0
- C#中有关字段的访问控制
- SQLite中有关datetime字段的处理
- C#中,当声明类、方法、字段、属性等时,访问权限的说明。
- C#中,当声明类、方法、字段、属性等时,访问权限的说明。
- ios 的 字段、方法、属性的访问权限控制
- C# 管理类的访问权限控制
- ASP中控制字段长度的函数
- Hibernate中有关重复定义字段的问题
- http中有关缓存相关的几个字段
- http中有关缓存相关的几个字段
- C#中有关数据库的数据转换
- C#中有关异常的捕获演示
- C#中有关属性的演示
- C#中有关修饰符的理解
- JNI中访问字段
- C#反射的学习(二)--访问字段、属性、方法
- C#中如何在外部类访问控制Form窗体控件
- C#中属性和字段的区别
- Oracle-多版本环境变量切换
- poj1837 Balance 天平和砝码
- 04 视图控制器
- AI学习过程(3)-异常检测
- 开发随笔-接口间参数
- C#中有关字段的访问控制
- 九度oj-1116-加减乘除
- POJ2584 T-Shirt Gumbo【二分图多重匹配】
- 关于lcm,gcd的一些性质
- error opening trace file: No such file or directory (2)报错原因
- 再见 MongoDB,你好 PostgreSQL
- jsp2的自定义标签
- 01_index 养生
- 安卓学习笔记(一)显式Intent与隐式Intent