1.

What Is The Use Of This Keyword In Dart?

Answer»

In Dart, this keyword refers to the CURRENT instance of the CLASS.

void main() {

CAR c1 = NEW Car('E1001');

}

class Car {

String engine;

Car(String engine) {

this.engine = engine;

print("The engine is : ");

}

}

In Dart, this keyword refers to the current instance of the class.

void main() {

Car c1 = new Car('E1001');

}

class Car {

String engine;

Car(String engine) {

this.engine = engine;

print("The engine is : ");

}

}



Discussion

No Comment Found