# Passing abstract structs to a function

**URL:** <https://discourse.julialang.org/t/passing-abstract-structs-to-a-function/99877>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [June 5, 2023, 9:03am UTC](https://discourse.julialang.org/t/passing-abstract-structs-to-a-function/99877 "2023-06-05T09:03:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Vasily\_Pisarev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vasily_pisarev/32/7929_2.png) [@Vasily\_Pisarev](https://discourse.julialang.org/u/Vasily_Pisarev)\
**Post date:** [June 5, 2023, 9:21am UTC](https://discourse.julialang.org/t/passing-abstract-structs-to-a-function/99877/2 "2023-06-05T09:21:43Z")

</div>

> [@Santos\_Michelena](#):
>
> as Vector{Sample{Float64}} is a subtype of Vector{Sample}

It is not (see [documentation](https://docs.julialang.org/en/v1/manual/types/#man-parametric-composite-types) and [other](https://discourse.julialang.org/t/whats-with-the-invariant-parametric-types-gotcha/55090) [discussions](https://discourse.julialang.org/t/why-1-2-3-is-not-a-vector-number/52645) [here](https://discourse.julialang.org/t/subtyping-conventions-for-dicts-are-unexpected/33040)).  
You need to explicitly specify the type as `Vector{<:Sample}` (and maybe the second type as `Vector{<:Function}`).

---

_[View the full topic](https://discourse.julialang.org/t/passing-abstract-structs-to-a-function/99877)._
