Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

with keyword in dart

mixin Human {
  String name;
  int age;

  void about();
}

class Doctor with Human {
  String specialization;
  Doctor(String doctorName, int doctorAge, String specialization) {
    name = doctorName;
    age = doctorAge;
    this.specialization = specialization;
  }

  void about() {
    print('$name is $age years old. He is $specialization specialist.');
  }
}


void main() {
  Doctor doctor = Doctor("Harish Chandra", 54, 'child');
  print(doctor.name);
  print(doctor.age);
  doctor.about();
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #keyword #dart
ADD COMMENT
Topic
Name
4+9 =