using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp13
{
public class Person
{
string id;
string name;
string height;
public void input()
{
Console.Write("请输入编号:");
id = Console.ReadLine();
Console.Write("请输入姓名:");
name = Console.ReadLine();
Console.Write("请输入身高:");
height = Console.ReadLine();
}
public void show()
{
Console.WriteLine("编号:{0}\n姓名:{1}\n身高:{2}",id,name,height);
}
}
class Teacher :Person
{ }
class Student : Person
{ }
internal class Program
{
static void Main(string[] args)
{
Teacher teacher = new Teacher();
Student student=new Student();
Console.WriteLine("请输入教师信息:");
teacher.input();
Console.WriteLine();
Console.WriteLine("请输入学生信息:");
student.input();
Console.WriteLine();
Console.WriteLine("教师的信息为:");
teacher.show();
Console.WriteLine();
Console.WriteLine("学生的信息为:");
student.show();
Console.ReadLine();
}
}
}
03-16
4473
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-10
1393
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-02
11-02
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-28
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交