美文网首页
15.Dart类的简单继承

15.Dart类的简单继承

作者: 凯司机 | 来源:发表于2020-05-27 05:57 被阅读0次

    main(List<String> args) {}

    class Animal {

      int age;

      Animal(this.age);

    }

    class Person extends Animal {

      String name;

      // 可以通过快速修复来创建

      Person(int age) : super(age);

      // 手动创建

      // Person(this.name, int age) : super(age);

    }

    相关文章

      网友评论

          本文标题:15.Dart类的简单继承

          本文链接:https://www.haomeiwen.com/subject/vyriahtx.html