赞
踩
一、P23、24、25内容总结
二、什么是类–老师用例子将解释了一下
三、构造器与析构器
//Student stu = new Student(); ()调用默认构造器 class Program { static void Main(string[] args) { Student s1 = new Student(1, "Timothy"); s1.Report(); } class Student { //Student 类的默认构造器 //很像一个方法,但是没有返回值类型 public Student(int id, string name) { this.ID = id; this.Name = name; } //析构器:一般用于释放内存 //当程序完成时系统会自动调用析构器 //在Student类中声明一个析构器,模拟释放内存的操作 ~Student() { Console.WriteLine("Bye!"); } pub
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。