Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpsanders/d5de734aadef826119f9 to your computer and use it in GitHub Desktop.
Save dpsanders/d5de734aadef826119f9 to your computer and use it in GitHub Desktop.
abstract Person
type Adult <: Person
age::Int
height::Float64
position::Int
end
type Child <: Person
age::Int
height::Float64
position::Int
at_school::Bool
end
type Bad <: Person
age::Int
end
function move!(p::Person)
p.position += 1
end
function move!(c::Child)
c.position += 1
c.at_school = get_ipython().getoutput('c.at_school')
end
a = Adult(3, 4, 5)
move!(a)
c = Child(3, 4, 5, true)
move!(c)
b = Bad(3)
move!(b) # error since does not have position field
@xgao32
Copy link

xgao32 commented Jul 5, 2016

Hey David,

We almost met at JuliaCon a few weeks ago. I am currently working on implementing an agent based model originally done in NetLogo to Julia or Python. Right now it seems Python has some support for making this work easier, but do you know how feasible this will be in Julia? Thanks.

https://github.com/gaomrx/mosquito-3d/blob/master/y-chromosome.nlogo3d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment