CObject
{
class Program
{
static[] args)
{
Console.WriteLine();
);
);
Convert.ToInt32(Console.ReadLine());
switch (num)
{
case);
Console.WriteLine(Schoolchild.Message);
break;
case);
Console.WriteLine(M_Student.Message);
break;
case);
Console.WriteLine(Undergraduate.Message);
break;
);
break;
}
Console.ReadLine();
}
}
{
internalstatic;
internalstatic;
internalinternal height)
{
type;
height;
}
}
{
internalstatic;
internalstatic;
internalinternal height)
{
type;
height;
}
}
{
internalstatic;
internalstatic;
internalinternal height)
{
type;
例子很简单,不过还算很能体现类和对象的关系,3个学生类的图示如下