首页 > 建站教程 > dart >  Dart编程实例 - 继承的类型正文

Dart编程实例 - 继承的类型

Dart编程实例 - 继承的类型

void main() {

   var obj = new Leaf();

   obj.str = "hello";

   print(obj.str);

}  

class Root {

   String str;

}  

class Child extends Root {}  

class Leaf extends Child {}  

//indirectly inherits from Root by virtue of inheritance