sytn.net
当前位置:首页 >> C#定义stuDEnt类 >>

C#定义stuDEnt类

C#定义一个有学生类-student类,然后定义一个方法fun(),通过委托实现方法回调,使之既能输C#定义一个有学生类-student类,然后定义一个方法fun(),通过委托实现方法回调,使之既能输出最

我写了个样例,你看一下,先定义Student public class Student { public string Name { get; set; } private DateTime _birthday; public DateTime Birthday { get { return _birthday; } set { _birthday = value; } } public int Age { get { return DateTime.Now.Year

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CShap_Test1 { class Student { public string Name { get; set; } public int Num { get; set; } public Student() :this("",0) { } public Student(string

基于net 3.51,2,3 可以参考下面的 class xuesheng { /// <summary> /// 学号 /// </summary> public int SNO { get; set; } /// <summary> ///名字 /// </summary> public String SName { get; set; } /// <summary> /// 性别 /// </summary> public String Sex{ get; set;

public class Student { private string myName; public string Name { get { return myName; } set { myName = value; } } private static int number; public static int Number { get { return number; } } private int myAge; public int Age { get { return myAge; } set

public struct student{ public int no; public string strName;public int age;Date birth;}里面的类型看实际情况.

可以帮你完成 再看看别人怎么说的.

public class Student{ public string Name {get;set;} public int Age{get;set;} //第一构造 public Student(string name) { Name = name; } public Student(int age) { Age = age; } public Student(string name, int age) { Name = name; Age = age; } }

这有什么问题么 class student { public string 学号{get;set;} public string 姓名{get;set;} public string 性别{get;set;} public string 年龄{get;set;} public void 输出(){Console.WriteLine(学号+姓名+性别+年龄)} }

很好奇,你们是学生吧? /// <summary> /// 定于学生对象 /// </summary> public class Student { /// <summary> /// 姓名 /// </summary> public string Name { get; set; } /// <summary> /// 年龄 /// </summary> public int Age { get; set; } } //定义学生对象数组

网站首页 | 网站地图
All rights reserved Powered by www.sytn.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com