zoukankan      html  css  js  c++  java
  • 多态

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace day06
    {
        public class Fu
        {
            public virtual void Cut() {
    
                Console.WriteLine("父类");
            }
    
        }
    }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace day06
    {
        public class Zi1:Fu
        {
            public override void Cut()
            {
                Console.WriteLine("理发师");
    
            }
    
        }
    }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace day06
    {
        class Program
        {
            static void Main(string[] args)
            {
                List<Fu> list = new List<Fu>()
                {
                    new Zi1(),        
                };
    
    
                foreach (Fu person in list)
                {
                    person.Cut();
                }
                Console.ReadKey();
            }
        }
    }
  • 相关阅读:
    解释器
    桥接
    组合
    hbase读性能优化
    Hbase为什么写比读快
    http和https区别
    R apply() 函数和 tapply() 函数
    R 语言 decostand() 函数
    R多行交叉作图
    k-mean 拐点
  • 原文地址:https://www.cnblogs.com/qjt970518--/p/6567131.html
Copyright © 2011-2022 走看看