# Is there a way to seamlessly inherit vector arithmetic on new types?

**URL:** <https://discourse.julialang.org/t/is-there-a-way-to-seamlessly-inherit-vector-arithmetic-on-new-types/19713>\
**Category:** General Usage\
**Created:** [January 16, 2019, 6:25pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-seamlessly-inherit-vector-arithmetic-on-new-types/19713 "2019-01-16T18:25:01Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 17, 2019, 7:19pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-seamlessly-inherit-vector-arithmetic-on-new-types/19713/9 "2019-01-17T19:19:34Z")

</div>

> [@philip](#):
>
> The only thing is, the FieldVector version seems to “forget” the original type in the computations (see below).

You can control this by overloading `StaticArrays.similar_type`. In this case:

```julia
StaticArrays.similar_type(::Type{TypeOneFV}, ::Type{Float64}, s::Size{(2,)}) = TypeOneFV

```

results in

```julia
julia> z_fv = r * x_fv - y_fv / r
2-element TypeOneFV:
 3.5
 7.25

```

---

_[View the full topic](https://discourse.julialang.org/t/is-there-a-way-to-seamlessly-inherit-vector-arithmetic-on-new-types/19713)._
