class Registration
{
public virtual void Register()
{
int Registration_System;
Console.Write("Registration System");
Console.Write("\n 1. Add Student" +
"\n 2. View Student" +
"\n 3. Search" +
"\n 4. Edit" +
"\n 5. Delete" +
"\n 6. Exit");
Console.Write("\nChoose: "); Registration_System = int.Parse(Console.ReadLine());
}
}
class Program //Main class
{
static void Main(string[] args)
{
Registration r = new Registration();
r.Register();
MSIT it = new MSIT();
MSCS cs = new MSCS();
}
}
所以基本上我需要访问Registration_System的值,以便在 Main 类的 if/else 系统中使用它们:
if (Registration_System == 1)
{
}
..
因为我错过了几节课,所以我将与至少 6 个其他课程一起做这个。到目前为止,我只需要为 If/Else 设置一个骨架,这样我就可以访问所有其他类,但如果不使用Registration_System的值,我就无法做到这一点。我做对了吗?还有其他方法吗?