# OOP in Julia, inherit from parametric composite type

**URL:** <https://discourse.julialang.org/t/oop-in-julia-inherit-from-parametric-composite-type/1841>\
**Category:** General Usage\
**Tags:** question, parametric-types, inheritance\
**Created:** [February 2, 2017, 12:52pm UTC](https://discourse.julialang.org/t/oop-in-julia-inherit-from-parametric-composite-type/1841 "2017-02-02T12:52:47Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [February 2, 2017, 1:31pm UTC](https://discourse.julialang.org/t/oop-in-julia-inherit-from-parametric-composite-type/1841/2 "2017-02-02T13:31:27Z")

</div>

There are two issues here:

1. allowing the compiler to generate efficient code,
2. reusing code when extending behavior.

Regarding (1), don’t worry about it too much. The first version of `getv1` will compile for concrete types, and will be efficient. It should not be necessary to document return types, the compiler will figure it out (in general, methods should just be [type-stable](http://docs.julialang.org/en/stable/manual/performance-tips/).

Regarding (2), see the [discussion here](https://discourse.julialang.org/t/workaround-for-traditional-inheritance-features-in-object-oriented-languages/1195/20).

---

_[View the full topic](https://discourse.julialang.org/t/oop-in-julia-inherit-from-parametric-composite-type/1841)._
