Created
October 10, 2020 07:37
-
-
Save Headmast/6a876e3849bb08efa1ab3ce3f8250c76 to your computer and use it in GitHub Desktop.
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() { | |
final p = SuperPrinter<int>(1); | |
p.doPrint(); | |
final pString = SuperPrinter<String>('Awesome dart'); | |
pString.doPrint(); | |
var st = Student(2020); | |
st.name = 'Stas'; | |
st.surname = 'Konovalov'; | |
final pStudent = SuperPrinter<Student>(st); | |
pStudent.doPrint(); | |
} | |
class SuperPrinter<T> { | |
T myValue; | |
SuperPrinter(this.myValue); | |
void doPrint() { | |
print('Try to print $myValue'); | |
} | |
} | |
class User { | |
String name; | |
String surname; | |
int sex; | |
} | |
class Student extends User { | |
int yearOfAdmission; | |
int get cuttentCourse => (DateTime.now().year - yearOfAdmission + 1); | |
Student(this.yearOfAdmission); | |
@override | |
String toString() { | |
return '$name $surname $yearOfAdmission $cuttentCourse'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Зачет. Все ок.