November 2017
Beginner
316 pages
6h 40m
English
This is similar to the issue we just discussed in the previous point, but with a distinction that the field in question is a container, such as an array or hashmap. Let's look at a quick example for that too:
julia> type SampleDataType
a
end
julia> alpha = SampleDataType([10,15,20])
SampleDataType([10,15,20])
As usual, the code given here is not efficient. However, the following code includes enhancements similar to the one discussed in the first point:
julia> type SampleDataType{T<:AbstractVector}
a :: T
end
julia> alpha = SampleDataType([10,20])
SampleDataType{Array{Int64,1}}([10,20])
julia>
Read now
Unlock full access