本节内容:

1:类是什么

2:声明类

3:类的使用

1:类是什么

2:声明类

在生产上的声明:如下操作   或者快捷操作 ctrl+shift+a 键

出现如下界面:

3:类的使用

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace cw
{
public enum gender //public 是为了让所有的类都可以使用
{
男,

}
public class Clerk
{ //
public string _name; //public是为了在静态方法中可以通过实例对象,使用
public gender _gerder;
public int _age; public void show()
{
Console.WriteLine("{0}是{1},{2}岁。",this._name,this._gerder,this._age); } }
}

cw 下的Clerk

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace cw
{
class Program
{
static void Main(string[] args)
{
//要想使用别的类要先实例化
Clerk zs = new Clerk();
zs._name = "张三";
zs._gerder = gender.男;
zs._age = ;
zs.show();
Console.ReadKey();
}
}
}

cw 下的Main所在类

输出:张三是男,34岁

最新文章

  1. 洛谷 P1182 数列分段Section II Label:贪心
  2. java 异步处理
  3. 对称密码-DES和3DES
  4. hdu4497 GCD and LCM ——素数分解+计数
  5. Java 线程池的原理与实现
  6. mrunit for wordcount demo
  7. 常州培训 day1 解题报告
  8. 使用第三方工具覆写Object中方法
  9. Android下实现tab页个人比较推崇的方法
  10. MongoDB开发学习(1)开天辟地,经典入门
  11. Android 之SparseArray<E>详解
  12. encode_json 会对给定的Perl的数据结构转换为一个UTF-8 encoded, binary string.
  13. 【一天一道LeetCode】#205. Isomorphic Strings
  14. centos 7创建ss服务(方式一)
  15. [leetcode]50. Pow(x, n)求幂
  16. Vue-条件渲染v-if与v-show
  17. BZOJ4785 ZJOI2017树状数组(概率+二维线段树)
  18. 泡泡一分钟:Automatic Parameter Tuning of Motion Planning Algorithms
  19. 可变数组(PLSQL)
  20. keras如何求分类问题中的准确率和召回率

热门文章

  1. Linux-3.14.12内存管理笔记【建立内核页表(1)】
  2. Go语言交叉编译工具gox
  3. Python:判断列表中含有字符串且组成新的列表打印输出-Dotest董浩
  4. go设计模式--单例singleton
  5. AHOI 2009 维护序列
  6. DirectShow 进行视频预览和录制
  7. js常用但是不容易记住的代码
  8. 【CF933E】A Preponderant Reunion(动态规划)
  9. java war包 路径--解决war包中文件路径问题
  10. MySQL学习——操作数据库