36 lines
363 B
Text
36 lines
363 B
Text
|
|
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();
|
|
|