chapter 13

This commit is contained in:
2018-07-27 18:35:39 +02:00
parent 580795cd2b
commit 668248bd84
6 changed files with 115 additions and 7 deletions

9
examples/inheritance.lox Normal file
View File

@@ -0,0 +1,9 @@
class Doughnut {
fn cook() {
print("Fry until golden brown.");
}
}
class BostonCream < Doughnut {}
BostonCream().cook();

14
examples/super.lox Normal file
View File

@@ -0,0 +1,14 @@
class Doughnut {
fn cook() {
print("Fry until golden brown.");
}
}
class BostonCream < Doughnut {
fn cook() {
super.cook();
print("Pipe full of custard and coat with chocolate.");
}
}
BostonCream().cook();