Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
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!(camera.roll, img)
|
||||
end
|
||||
|
||||
dphone = DeskPhone(Dict(["information" => "411"]))
|
||||
cphone = CellPhone(Dict(["emergency" => "911"]), [[]])
|
||||
|
||||
dialnumber(dphone)
|
||||
dialnumber(cphone)
|
||||
Loading…
Add table
Add a link
Reference in a new issue