Skip to content

Instantly share code, notes, and snippets.

@Headmast
Last active October 8, 2020 09:19
Show Gist options
  • Save Headmast/ef10749ab1ab2a1f4f4f2ee543915799 to your computer and use it in GitHub Desktop.
Save Headmast/ef10749ab1ab2a1f4f4f2ee543915799 to your computer and use it in GitHub Desktop.
main() {
var userMain = User();
userMain.name = 'Boris';
print('Your name: ${userMain.name}');
var st = Student(2020);
st.name = 'Stas';
st.surname = 'Konovalov';
print('New student: $st');
}
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