Skip to content

Instantly share code, notes, and snippets.

@criskgl
Created July 5, 2021 12:24
Show Gist options
  • Save criskgl/750ea488f09dcb8e332b2dba7d0e8a3b to your computer and use it in GitHub Desktop.
Save criskgl/750ea488f09dcb8e332b2dba7d0e8a3b to your computer and use it in GitHub Desktop.
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