1.

What Is Method Overriding In Dart?

Answer»

In Dart, Method Overriding is a technique that CHILD class redefines a method in its parent class.

Example:

VOID main() {

Child C = new Child();

c.m1(12);

}

class Parent {

void m1(INT a){ print("value of a ");}

}

class Child extends Parent {

@override

void m1(int b) {

print("value of b ");

}

}

In Dart, Method Overriding is a technique that child class redefines a method in its parent class.

Example:

void main() {

Child c = new Child();

c.m1(12);

}

class Parent {

void m1(int a){ print("value of a ");}

}

class Child extends Parent {

@override

void m1(int b) {

print("value of b ");

}

}



Discussion

No Comment Found