# Error: invalid subtyping in definition of a type

#1

I am trying to understand why I get an error

``````ERROR: invalid subtyping in definition of StringIndexVector
``````

where I try to define

``````struct StringIndexVector <: AbstractVector
svec::Vector{String}
index::Vector{Integer}
end
``````

but the below is fine. I think AbstractVector is an AbstractType so I can define a subtype under it.

``````struct StringIndexVector
svec::Vector{String}
index::Vector{Integer}
end
``````

I am on Julia 0.6.2

#2

You need to define the `T` in `AbstractVector{T} where T` e.g.

``````struct StringIndexVector{T} <: AbstractVector{T}
svec::Vector{String}
index::Vector{Integer}
end
``````

For efficiency, you probably want to use `Int` instead of `Integer` in your `index`-`Vector` (or parameterize on the integer type).

#3

On julia-0.6.2 I’m getting the same error when trying to declare

``````struct wrapping_hypercube{N,T} <: hypercube{N,T} end
``````

`hypercube` is:

``````struct hypercube{N,T}
...
end
``````

#4

The answer is in the manual: I can’t subtype from concrete types. Thanks!