Skip to content

Instantly share code, notes, and snippets.

@Headmast
Created October 10, 2020 07:37
Show Gist options
  • Save Headmast/6a876e3849bb08efa1ab3ce3f8250c76 to your computer and use it in GitHub Desktop.
Save Headmast/6a876e3849bb08efa1ab3ce3f8250c76 to your computer and use it in GitHub Desktop.
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';
}
}
@vlad-bel
Copy link

Зачет. Все ок.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment