June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -0,0 +1,20 @@
abstract type Mammal end
habitat(::Mammal) = "planet Earth"
struct Whale <: Mammal
mass::Float64
habitat::String
end
Base.show(io::IO, ::Whale) = print(io, "a whale")
habitat(w::Whale) = w.habitat
struct Wolf <: Mammal
mass::Float64
end
Base.show(io::IO, ::Wolf) = print(io, "a wolf")
arr = [Whale(1000, "ocean"), Wolf(50)]
println("Type of $arr is ", typeof(arr))
for a in arr
println("Habitat of $a: ", habitat(a))
end