September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -1,24 +1,24 @@
|
|||
class CameraFeature =
|
||||
singleton CameraFeature
|
||||
{
|
||||
cameraMsg
|
||||
= "camera".
|
||||
}.
|
||||
= "camera";
|
||||
}
|
||||
|
||||
class MobilePhone
|
||||
{
|
||||
mobileMsg
|
||||
= "phone".
|
||||
= "phone";
|
||||
}
|
||||
|
||||
class CameraPhone :: MobilePhone
|
||||
class CameraPhone : MobilePhone
|
||||
{
|
||||
dispatch => CameraFeature.
|
||||
dispatch() => CameraFeature;
|
||||
}
|
||||
|
||||
program =
|
||||
[
|
||||
var cp := CameraPhone new.
|
||||
public program()
|
||||
{
|
||||
var cp := new CameraPhone();
|
||||
|
||||
console writeLine(cp cameraMsg).
|
||||
console writeLine(cp mobileMsg).
|
||||
].
|
||||
console.writeLine(cp.cameraMsg);
|
||||
console.writeLine(cp.mobileMsg)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
import system'dynamic.
|
||||
import system'dynamic;
|
||||
|
||||
class CameraFeature
|
||||
{
|
||||
cameraMsg
|
||||
= "camera".
|
||||
= "camera";
|
||||
}
|
||||
|
||||
class MobilePhone
|
||||
{
|
||||
mobileMsg
|
||||
= "phone".
|
||||
= "phone";
|
||||
}
|
||||
|
||||
class CameraPhone =
|
||||
singleton CameraPhone
|
||||
{
|
||||
new = MobilePhone new; mixInto(CameraFeature new).
|
||||
}.
|
||||
new() = new MobilePhone().mixInto(new CameraFeature());
|
||||
}
|
||||
|
||||
program =
|
||||
[
|
||||
var cp := CameraPhone new.
|
||||
public program()
|
||||
{
|
||||
var cp := CameraPhone.new();
|
||||
|
||||
console writeLine:(cp cameraMsg).
|
||||
console writeLine:(cp mobileMsg).
|
||||
].
|
||||
console.writeLine(cp.cameraMsg);
|
||||
console.writeLine(cp.mobileMsg)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
TUPLE: camera ;
|
||||
TUPLE: mobile-phone ;
|
||||
UNION: camera-phone camera mobile-phone ;
|
||||
35
Task/Inheritance-Multiple/Julia/inheritance-multiple.julia
Normal file
35
Task/Inheritance-Multiple/Julia/inheritance-multiple.julia
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
abstract type Phone end
|
||||
|
||||
struct DeskPhone <: Phone
|
||||
book::Dict{String,String}
|
||||
end
|
||||
|
||||
abstract type Camera end
|
||||
|
||||
struct kodak
|
||||
roll::Vector{Array{Int32,2}}
|
||||
end
|
||||
|
||||
struct CellPhone <: Phone
|
||||
book::Dict{String,String}
|
||||
roll::Vector{AbstractVector}
|
||||
end
|
||||
|
||||
function dialnumber(phone::CellPhone)
|
||||
println("beep beep")
|
||||
end
|
||||
|
||||
function dialnumber(phone::Phone)
|
||||
println("tat tat tat tat")
|
||||
end
|
||||
|
||||
function snap(camera, img)
|
||||
println("click")
|
||||
push!(roll, img)
|
||||
end
|
||||
|
||||
dphone = DeskPhone(Dict(["information" => "411"]))
|
||||
cphone = CellPhone(Dict(["emergency" => "911"]), [[]])
|
||||
|
||||
dialnumber(dphone)
|
||||
dialnumber(cphone)
|
||||
3
Task/Inheritance-Multiple/Rust/inheritance-multiple.rust
Normal file
3
Task/Inheritance-Multiple/Rust/inheritance-multiple.rust
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
trait Camera {}
|
||||
trait MobilePhone {}
|
||||
trait CameraPhone: Camera + MobilePhone {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue