Created
April 11, 2022 15:00
-
-
Save bigbany/751e78172c503365bbbc3b140ffd5d30 to your computer and use it in GitHub Desktop.
about generic
This file contains hidden or 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(){ | |
Lecture<String> lecture1 = Lecture('123','lecture1'); | |
lecture1.printIdType(); | |
} | |
// generic - 타입을 외부에서 받을때 사용 | |
class Lecture<T> { | |
final T id; | |
final String name; | |
Lecture(this.id, this.name); | |
void printIdType(){ | |
print(id.runtimeType); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment