C#练习:属性定义练习
发布时间
阅读量:
阅读量
设计一个学生类,该类包含五个数据成员:学号、姓名、性别、年龄以及所属学院,并配备多个成员函数。同时编写主函数以调用该类,完成对学生信息的赋值与显示操作。具体要求如下:需通过成员函数实现学生信息的展示功能;利用构造函数完成数据的初始化操作,可对构造函数进行重载以支持多种输入方式。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace student
{
class Program
{
static void Main(string[] args)
{
student 胡图图 = new student("胡图图", "222", "123456", 2, "翻斗大街中心幼儿园小一班");
胡图图.print();
Console.ReadKey();
}
}
public class student
{
public string xh;
public string xm;
全部评论 (0)
还没有任何评论哟~
