# About inheritance and abstract types

**URL:** <https://discourse.julialang.org/t/about-inheritance-and-abstract-types/5801>\
**Category:** New to Julia\
**Tags:** inheritance\
**Created:** [September 9, 2017, 5:28pm UTC](https://discourse.julialang.org/t/about-inheritance-and-abstract-types/5801 "2017-09-09T17:28:13Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [June 11, 2020, 2:41pm UTC](https://discourse.julialang.org/t/about-inheritance-and-abstract-types/5801/12 "2020-06-11T14:41:55Z")

</div>

If all subtypes have the field, then

```julia
get_type(curve::BaseType) = curve.type

```

works. And if some subtype then goes and puts that info elsewhere, then you can special-case it:

```julia
get_type(curve::SomeSubType) = curve.some_other_field

```

---

_[View the full topic](https://discourse.julialang.org/t/about-inheritance-and-abstract-types/5801)._
