Last active
April 25, 2020 11:58
-
-
Save momshaddinury/8c645ba92349e7ebd8ac927ff30fa972 to your computer and use it in GitHub Desktop.
Explain the code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
var _patient = Patient(); | |
var _covidPatient = CovidPatient(); | |
var _testResult = TestResult(); | |
_patient.setPatientData("Tuhin", "Male", 24); | |
print(_patient.patientData.values); | |
_covidPatient.name = "John"; | |
print(_covidPatient.name); | |
_testResult.testResult = "Positive"; | |
_covidPatient.isInfected = _testResult.testResult; | |
print(_covidPatient.isInfected); | |
} | |
class Patient { | |
String _name; | |
String _gender; | |
int _age; | |
Map<String, dynamic> get patientData { | |
return {"name": _name, "gender": _gender, "age": _age}; | |
} | |
setPatientData(String name, String gender, int age) { | |
this._name = name; | |
this._gender = gender; | |
this._age = age; | |
} | |
//Patient(this.name, this.gender, this.age); | |
set name(String name) => this._name = name; | |
String get name => _name; | |
} | |
class CovidPatient extends Patient { | |
bool _isInfected; | |
set isInfected(String result) => | |
result == "Positive" ? _isInfected = true : _isInfected = false; | |
get isInfected => _isInfected; | |
} | |
class TestResult { | |
String _testResult; | |
set testResult(String result) => this._testResult = result; | |
String get testResult => _testResult; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment