zoukankan      html  css  js  c++  java
  • c#抽象类

    using System;
    using System.Collections.Generic;
    using System.Linq;abstract抽象
    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();
            }
        }
    }
  • 相关阅读:
    matlab 自定义函数及调用
    matlab 逻辑数组及其应用
    matlab 嵌套循环的学习
    matlab和C语言的break及continue测试
    matlab 向量法建数组(推荐)
    matlab for循环应用(阶乘及the day of year)
    matlab for循环的三种类型
    ORACLE创建用户,建表空间,授予权限
    Linux计划任务
    android开发环境搭建
  • 原文地址:https://www.cnblogs.com/qufeiba/p/6896565.html
Copyright © 2011-2022 走看看