跪求高手...请问下面一代码那里错误了....
using System;using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _2._12
{
class Program
{
public class Student
{
private string m_name;
private int m_grade;
public string Name
{
get
{
return m_name;
}
set
{
this.m_name = value;
}
}
public int Grade
{
get
{
return m_grade;
}
set
{
m_grade = value;
}
}
public Student()
{
Grade = 1;
}
public abstract string Introduce();
}
public class Pupil : Student
{
public override string Introduce()
{
if (Grade >= 1 && Grade < 7)
return "This is an pupil of grade " + Grade;
else
return "No such grade";
}
}
public class Undergraduate : Student
{
public override string Introduce()
{
if (Grade > 0 && Grade < 5)
return "This is an undergraduate of grade" + Grade.ToString();
else
return "No such grade";
}
}
public class Graduate : Student
{
public override string Introduce()
{
if (Grade >= 1 && Grade < 4)
return "This is a graduate of grade " + Grade;
else
return "No such grade";
}
}
static void Main(string[] args)
{
Student student;
Pupil pu = new Pupil();
student = pu;
pu.Grade = 5;
Console.WriteLine(student.Introduce());
Undergraduate un = new Undergraduate();
student = un;
un.Grade = 5;
Console.WriteLine(student.Introduce());
Graduate gr = new Graduate();
student = gr;
Console.WriteLine(student.Introduce());
Console.WriteLine("按回车键结束");
Console.Read();
}
}
}
报这个错误....Introduce()是抽象类但他包含了非抽象类....
跪求高手改正错误...