implementing superclasses (ch29)

This commit is contained in:
2024-09-01 11:58:57 +02:00
parent 1300c42a09
commit 980312bd62
10 changed files with 146 additions and 7 deletions

View File

@ -0,0 +1,21 @@
class Doughnut {
cook() {
print "Dunk in the fryer.";
}
zzz() {
print "Bla";
}
}
class Cruller < Doughnut {
finish() {
print "Glaze with icing.";
}
}
var o2 = Cruller();
o2.cook();
o2.finish();

View File

@ -0,0 +1,19 @@
class A {
method() {
print "A method";
}
}
class B < A {
method() {
print "B method";
}
test() {
this.method();
super.method();
}
}
class C < B {}
C().test();

View File

@ -0,0 +1,2 @@
class Cake < Cake {
}

View File

@ -0,0 +1,2 @@
var NotClass = "So not a class";
class OhNo < NotClass {}