A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
32
Task/Inheritance-Multiple/Fantom/inheritance-multiple.fantom
Normal file
32
Task/Inheritance-Multiple/Fantom/inheritance-multiple.fantom
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// a regular class
|
||||
class Camera
|
||||
{
|
||||
Str cameraMsg ()
|
||||
{
|
||||
"camera"
|
||||
}
|
||||
}
|
||||
|
||||
// a mixin can only contain methods
|
||||
mixin MobilePhone
|
||||
{
|
||||
Str mobileMsg ()
|
||||
{
|
||||
"mobile phone"
|
||||
}
|
||||
}
|
||||
|
||||
// class inherits from Camera, and mixes in the methods from MobilePhone
|
||||
class CameraPhone : Camera, MobilePhone
|
||||
{
|
||||
}
|
||||
|
||||
class Main
|
||||
{
|
||||
public static Void main ()
|
||||
{
|
||||
cp := CameraPhone ()
|
||||
echo (cp.cameraMsg)
|
||||
echo (cp.mobileMsg)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue