using System;
using System.Collections.Generic;
using System.Text;
namespace 抽象类
{
public abstract class information//定义抽象
{
public string Code { get;set;}
public string Name { get; set; }
public abstract void Showinfo();
}
public class JHinfo : information
{
public override void Showinfo()
{
Console.WriteLine("进货信息:
"+Code+""+Name);
}
}
public class SHinfo : information
{
public override void Showinfo()
{
Console.WriteLine("销售信息:
"+Code+""+Name);
}
}
}
class Program
{
static void Main(string[] args)
{
JHinfo jh = new JHinfo();
SHinfo sh = new SHinfo();
jh.Code = "战神";
jh.Name = "笔记本电脑";
sh.Code = "荣耀100";
sh.Name = "华为手机";
jh.Showinfo();
sh.Showinfo();
Console.ReadKey();
}
}
}