RosettaCodeData/Task/Inheritance-Multiple/Elena/inheritance-multiple-2.elena

27 lines
350 B
Text
Raw Permalink Normal View History

2019-09-12 10:33:56 -07:00
import system'dynamic;
2016-12-05 22:15:40 +01:00
2017-09-23 10:01:46 +02:00
class CameraFeature
2016-12-05 22:15:40 +01:00
{
2017-09-23 10:01:46 +02:00
cameraMsg
2019-09-12 10:33:56 -07:00
= "camera";
2016-12-05 22:15:40 +01:00
}
2017-09-23 10:01:46 +02:00
class MobilePhone
2016-12-05 22:15:40 +01:00
{
2017-09-23 10:01:46 +02:00
mobileMsg
2019-09-12 10:33:56 -07:00
= "phone";
2016-12-05 22:15:40 +01:00
}
2019-09-12 10:33:56 -07:00
singleton CameraPhone
2016-12-05 22:15:40 +01:00
{
2019-09-12 10:33:56 -07:00
new() = new MobilePhone().mixInto(new CameraFeature());
}
2016-12-05 22:15:40 +01:00
2019-09-12 10:33:56 -07:00
public program()
{
var cp := CameraPhone.new();
2016-12-05 22:15:40 +01:00
2019-09-12 10:33:56 -07:00
console.writeLine(cp.cameraMsg);
console.writeLine(cp.mobileMsg)
}