private.cs
来自「深入浅出C#,学习C#比较好的用例,能够很快掌握C#.」· CS 代码 · 共 39 行
CS
39 行
using System;
class Student
{
private string name;
private int id;
public Student(int id,string name)
{
this.id=id;
this.name=name;
}
public string getname()
{
return name;
}
public int getid()
{
return id;
}
}
class Mainclass
{
public static void Main()
{
Console.Write("Enter the id of the student:");
string str=Console.ReadLine();
int id=int.Parse(str);
Console.Write("Enter the name of the student:");
string name=Console.ReadLine();
Student student=new Student(id,name);
Console.WriteLine("Your input:id={0},name={1}",student.getid(),student.getname());
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?