What is overriding in DART language

In this article, i am going to explain about overriding in DART.
  • 2438

Overriding in DART

In overriding, a method in a parent class is overridden in the child class. The method in the child class will have the same signature as that of the parent class. Since the method in the child class has the same signature & name as the method of its parent class, it is termed as overriding.

Example of method overriding

class OverrideDart{

  Dartover(){

    print("I am a super class");

  }

}

class ExtOver extends  OverrideDart{

  Dartover(){

    print("I am a base class");

}

}

  void main(){

    ExtOver obj = new ExtOver();

    obj.Dartover();
  }

Output:

 overridedart.jpg

Ask Your Question 
 
Got a programming related question? You may want to post your question here
 
© 2019 DotNetHeaven. All rights reserved.