我遇到了一些代码的问题,它覆盖了已声明的先前对象的名称.
我看不出修复.我试图多次修复它,我的同学找不到修复,我的老师也找不到.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OOP
{
class Student
{
private static string name;
private static DateTime DOB;
private static int ID;
private static double height;
private static string tutor;
public Student()
{
Console.Clear();
//Console.WriteLine("This is for student: " + (count + 1));
Console.WriteLine("Please enter the student's name");
name = Console.ReadLine();
//tryagain:
//try
//{
// Console.WriteLine("Please enter the Date of Birth");
// DOB = DateTime.Parse(Console.ReadLine());
// DOB = DOB.Date;
//}
//catch
//{ …Run Code Online (Sandbox Code Playgroud)