Dart Inheritance : Multi-level Hierarchy

Dart Inheritance : Multi-level Hierarchy

·

1 min read

Multi-level Hierarchy :

  • In this type of inheritance, parent class is inherited by multiple subclasses.

  •   class One {
    
          void show () {
              print('object of one');
          }
      }
    
      class Two extends One {
    
          void her () {
              pritn('object of two');
          }
      }
    
      class Three extends Two {}
    
      void main() {
          var obj = One();
    
          var obj1 = Three();
    
          obj.show();
    
          obj1.her();
    
      }
    
  •   object of one
      object of two
    
      Exited.