我正在制作一个 SchoolApp 程序来学习 C# 并且我有这个主要功能,我正在尝试使其工作:
namespace SchoolApp
{
class Program
{
public static void Main(string[] args)
{
School sch = new School("Local School");
sch.AddStudent(new Student { Name = "James", Age = 22 }); // this function
sch.AddStudent(new Student { Name = "Jane", Age = 23 });
Console.WriteLine(sch); // this implementation
}
}
}
Run Code Online (Sandbox Code Playgroud)
学校班级:
namespace SchoolApp
{
class School
{
public string name;
public School()
{
}
public School(string the_name)
{
name = the_name;
}
public void AddStudent(Student student)
{ …Run Code Online (Sandbox Code Playgroud)