Inheritance 13

This commit is contained in:
nazrin 2025-06-02 23:44:23 +00:00
parent d8ac625429
commit 848c846e09
12 changed files with 117 additions and 7 deletions

36
test/super.lox Normal file
View file

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