Created
July 15, 2015 17:41
-
-
Save dpsanders/d5de734aadef826119f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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