zoukankan      html  css  js  c++  java
  • C#子类访问基类成员

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace ConsoleApplication2
    {
        class Program
        {
            static void Main(string[] args)
            {
                zzl z=new zzl();
                Console.WriteLine("zzl class a={0}",z.a());
                zzl2 z2=new zzl2();
                Console.WriteLine("zzl2 class a={0}",z2.a());
                Console.ReadKey();
            }
        }
        public class zzl
        {
            public  virtual int  a()
            {
                int a;
                int b;
                a = 1;
                b = 1;
                return a;
            }
        }
        public class zzl2:zzl
        {
            public  override int a()
            {
                int a;
                int b;
                a = 2;
                b = 2;
               return base.a();
            }
          
        }
    }

    结果为:

    zzl class a=1

    zzl2 class a=1

  • 相关阅读:
    Spring Bean的作用域类型
    spring depends-on
    spring bean parent属性详解
    spring中autowire的用法
    Spring容器的属性配置详解的六个专题
    Spring bean注入方式
    Spring入门示例
    如何从官网下载Spring
    Hibernate 缓存
    [转]javascript Date format(js日期格式化)
  • 原文地址:https://www.cnblogs.com/lori/p/1687869.html
Copyright © 2011-2022 走看看