欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

es6类的继承

程序员文章站 2022-07-13 09:33:09
...

1、es6类的继承:

class Father{
            constructor(){
                this.xx = "A";
                this.dna = "染色体";

            }
        }
    class Child extends Father{
        constructor (){
            super();
            this.name = "euanxiaohua"
            this.age = 18
        }

    }
    const child = new Child()
    console.log(child)

es6类的继承