10-3.cs

来自「java基础方面的一些实例代码」· CS 代码 · 共 35 行

CS
35
字号
//程序10-3
using System;
public class Student	
{
	protected string   studName;
	protected int      ID;
	protected string   contactPhone;
	public Student(string i ,int j, string k)
	{
		studName = i ;
		ID = j ;
		contactPhone = k;		
	}
}
public class CollegeStudent : Student
{
	public CollegeStudent(string i,int j,string k) :base(i,j,k)
	{ }
	public override string ToString()
	{
		return studName;
	}
}
class Test
{
	static void Main(string[] args)
	{
		Student StudentA = new Student("maggie",2000379,"56335568");
		CollegeStudent StudentB = new CollegeStudent ("maggie",2000379,"56335568");
		Console.WriteLine (StudentA);
		Console.WriteLine (StudentB);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?