首页 > 其他分享 >base

base

时间:2023-07-13 14:56:23浏览次数:23  
标签:Console Person base WriteLine Employee public

子类继承父类,重写父类,在子类中调用父类被覆盖的方法。

    public class Person
    {
        public virtual void GetInfo()//要标明是什么函数;virtual虚函数
        {
            Console.WriteLine("qqqqqqqe");
        }
    }
    class Employee:Person
    {
        public override void GetInfo()
        {
            base.GetInfo();
            Console.WriteLine("11111");
        }
        public void Info()
        {
            base.GetInfo();
        }
    }
    class Program
    {
        static void Main(string[] args)
        {


            Employee e = new Employee();
            e.Info();
            Console.WriteLine("-----------");
             e.GetInfo();
            Console.ReadLine();
        }
    }

子类的构造函数实例化是调用父类的构造函数

    public class Person
    {
        public Person()
        {
            Console.WriteLine("1234");
        }
        public Person(int i)
        {
            Console.WriteLine($"编号:{i}");
        }
    }
    class Employee:Person
    {

        public Employee() : base()
        {

        }
        public Employee(int i) : base(i)
        {
            Console.WriteLine(i);
        }

    }
    class Program
    {
        static void Main(string[] args)
        {

            Employee e = new Employee();
            Employee em = new Employee(1);
            Console.ReadLine();
        }
    }

 

标签:Console,Person,base,WriteLine,Employee,public
From: https://www.cnblogs.com/lin-07/p/17550455.html

相关文章

  • 怎么解决java Base64 decode windows和linux不一样 这个问题怎么解决?
    解决JavaBase64解码在Windows和Linux上不一致的问题在Java中,使用Base64进行编码和解码是一种常见的操作。然而,有时候会遇到一个问题,就是在Windows和Linux上进行Base64解码时,结果可能会不一致。这个问题一般是由于操作系统之间的换行符差异引起的。问题描述当我们在Windows上进......
  • Scala连接Hbase集群出现异常tried to access method com.google.common.base.Stopwatc
    总结/朱季谦在新项目上创建以下Scala代码去连接Hbase集群,用来判断Hbase是否存在某张表。//离线Hbasevalconf:Configuration=HBaseConfiguration.create()conf.set("hbase.zookeeper.quorum","192.168.1.200")conf.set("hbase.zookeeper.property.clientPort","2181&......
  • ORA-65221 signalled during: alter pluggable database application APP$CDB$SYSTEM
    给一台Oracle19.12.0.0.0数据库应用补丁,升级到Oracle19.16.0.0.0时,做datapatch的时候,监控发现数据库的告警日志出现下面错误:2023-07-11T15:09:44.776403+08:00alter pluggable database application APP$CDB$SYSTEM begin install '1.0'ORA-65221 signalled during: ......
  • GBase安装
    mkdir-p/opt/GBase/data/dn1_1mkdir-p /opt/GBase/gbase_packagemkdir-p /opt/GBase/gbase_dbmkdir-p/mnt/sdb/datagroupaddgbaseuseradd-m-d/home/gbasegbase-ggbasepasswdgbasechown-Rgbase:gbase/mnt/sdbchown-Rgbase:gbase/opt/GBase visud......
  • GBase基础使用
    1、设置远程访问GBase程序上控制了gbase用户不允许远程访问。所以需要自己创建一个超级用户。sugbase gs_gucreload-Nall-Iall-h"hostallall0.0.0.0/0sha256"查看监听gs_guccheck-Nall-Iall-c"listen_addresses" 如果不为*则修改为*gs_gucreloa......
  • HBase CRUD client
    #requirement.txthappybase==1.2.0"""hbase.py"""#-*-coding:utf-8-*-importhappybasefromconfig.hbase_configimportHAPPYBASE_HBASE#HAPPYBASE_HBASE={#"host":"xxx.xxx.xxx.xxx",#&......
  • LWC 51:682. Baseball Game
    LWC51:682.BaseballGame传送门:682.BaseballGameProblem:You’renowabaseballgamepointrecorder.Givenalistofstrings,eachstringcanbeoneofthe4followingtypes:Integer(oneround’sscore):Directlyrepresentsthenumberofpointsyougetinthis......
  • CTFer成长记录——CTF之Misc专题·base32
    一、题目链接https://ctf.show/challenges#萌新隐写5-112二、题意分析    打开后是一张神奇的txt文件,一开始我们可以尝试将文件丢入winhex中,找找有没有信息。这个题就是通过winhex中的信息,获取到一串密文,根据密文的特征最后解出flag。三、解法步骤  用winhex打开......
  • Effective Diversity in Population-Based Reinforcement Learning
    发表时间:2020(NeurIPS2020)文章要点:这篇文章提出了DiversityviaDeterminants(DvD)算法来提升种群里的多样性。之前的方法通常都考虑的两两之间的距离,然后设计一些指标或者加权来增加种群多样性,这种方式容易出现cycling,也就是类似石头剪刀布的循环克制的关系,造成训练不上去,......
  • HBase 分布式部署(进阶中级)
    1.HBase分布式部署(进阶中级)1.实验任务一:部署前期准备1.1.步骤一:安装部署hadoopha分布式环境1.2.步骤二:解压安装文件[root@master~]#cd[root@master~]#lsanaconda-ks.cfgjdk-8u152-linux-x64.tar.gzhadoop-2.7.1.tar.gzzookeeper-3.4.8.tar.gzhb......