Add instantiation of object to vector

You’ve defined foos as the type, not as an instance. You just need Vector{Foo}() instead:

julia> foos = Vector{Foo}()
0-element Array{Foo,1}

julia> for i in 1:3
       foo = Foo(randn(), 0)
       push!(foos, foo)
       end

julia> foos[2].x
0.7274441671361673
5 Likes