Created
July 5, 2021 12:24
-
-
Save criskgl/750ea488f09dcb8e332b2dba7d0e8a3b 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() { | |
List<String> myList = ['One', 'Two', 'Three']; | |
Parent papa = Parent(questions: myList); | |
Child child = Child(myList); | |
print(child._questions); | |
print(child.qn); | |
child.next(); | |
print(child.qn); | |
print(papa.qn); | |
} | |
class Parent{ | |
int qn = 0; | |
final List<String> _questions; | |
Parent({required List<String> questions}): _questions = questions; | |
void next(){ | |
this.qn++; | |
} | |
} | |
class Child extends Parent { | |
Child(List<String> qs) : super(questions: qs); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment