小编Jac*_*wer的帖子

c#OOP中包含对象的数组

我遇到了一些代码的问题,它覆盖了已声明的先前对象的名称.

我看不出修复.我试图多次修复它,我的同学找不到修复,我的老师也找不到.

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)

c# arrays oop object

-3
推荐指数
1
解决办法
121
查看次数

标签 统计

arrays ×1

c# ×1

object ×1

oop ×1