We can use the super keyword to access the parent class constructor. The super keyword can call both parameterized and non-parameterized constructors depending on the situation. The syntax is given below. Syntax: :super(); Example – // Base class called Parent class Parent { Parent() { print(“This is the super class constructor”); } } // Child class Super class Child extends Parent { Child():super() // Calling super class constructor { print(“This is the sub class constructor”); } } void main() { // Creating object of sub class … Continue reading Using super keyword with constructor
Tag: @super keyword
Dart – Super keyword
In Dart, super keyword is used to refer immediate parent class object. It is used to call properties and methods of the superclass. It does not call the method, whereas when we create an instance of subclass than that of the parent class is created implicitly so super keyword calls that instance. Advantages of super keyword: It… Continue reading Dart – Super keyword