I am very confused as to whether abstract
types in Julia can have member variables (like virtual classes in C++). I am sure the docs mention it but I cannot find it!
I tried something like:
abstract AbstractR
source
end
And now I have a concrete implementation as:
type RR <: AbstractR
end
function loadSource(reg::RR, x::AbstractString)
println("Hello")
end
However, when I try to load the module, I have:
ERROR: LoadError: LoadError: LoadError: UndefVarError: source not defined
So is it that abstract type is just a type name and nothing else? Also, why did the language designers decide to not support member variables (if that is indeed the case). Also, I do not then really see the point of having an abstract
type anyway...
EDIT
Module file
module TestProj
export AbstractR
export RR
include("generic.jl")
include("rr.jl")
end
generic.jl
abstract AbstractR
source
end
rr.jl
type RR <: AbstractR
end
function loadSource(reg::RR, x::AbstractString)
println("Hello")
end