注册 登录
编程论坛 C# 论坛

哪位大神帮忙看哈错误啊,小弟对这块不是很懂啊

雪月 发布于 2013-11-19 23:45, 522 次点击
namespace person
{
    public class Person
    {
        public string Name;
        public int Age;
        public Person(string name, int age)
        {
            this.Name = name;
            this.Age = age;
        }
        public void  ShowInfo()

        {
              //  Console.RriteLine(name,age);
                Console.WriteLine("Name is:{0}",Name);
                Console.WriteLine("Age is:{1}",Age);
                return ;
            
        }


  
        public class Student:Person
        {
          //  public string Name;
           // public int Age;
            public int Number;
        
            public  Student(string name,int age , int number):base(name, age)
            {
                this.Name = name;
                this.Age = age;
                this.Number = number;
            }
            public  void ShowNum(int number)
            {
            //    Console.ReadLine(number);
                Console.WriteLine("number is:{2}".Number);
            }
        
        }

    }


  class Program
    {
        static void Main(string[] args)
        {
            Person per = new Person("肖惜淼",22);
            Person.ShowInfo();

        }
    }
}
4 回复
#2
qw11617485792013-11-20 09:11
per.ShowInfo();
#3
芥末小弟2013-11-20 09:35
lz想干嘛?哪里不懂?
#4
雪月2013-11-20 22:41
回复 2楼 qw1161748579
灰常感谢你,不过在Number那还有个错误

错误    1    “string”并不包含“Number”的定义    person\person\Program.cs    43    51    person
搞不清楚为撒,我明明定义的是  int
#5
cppcui2013-11-21 21:13
回复 4楼 雪月
同学 编程要细心
Console.WriteLine("number is:{2}".Number);
Number前面应该是 逗号
1