# How to enforce the fields to be inherited?

**URL:** <https://discourse.julialang.org/t/how-to-enforce-the-fields-to-be-inherited/20693>\
**Category:** New to Julia\
**Tags:** inheritance\
**Created:** [February 12, 2019, 5:03am UTC](https://discourse.julialang.org/t/how-to-enforce-the-fields-to-be-inherited/20693 "2019-02-12T05:03:41Z")\
**Posts on this page:** 1\
**Showing post:** 8

<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:** [February 12, 2019, 10:39am UTC](https://discourse.julialang.org/t/how-to-enforce-the-fields-to-be-inherited/20693/8 "2019-02-12T10:39:35Z")

</div>

> **[GitHub - gcalderone/ReusePatterns.jl: Implement composition and concrete...](https://github.com/gcalderone/ReusePatterns.jl)**
>
> Implement composition and concrete subtyping in Julia. - GitHub - gcalderone/ReusePatterns.jl: Implement composition and concrete subtyping in Julia.

> [@Why is it impossible to subtype a struct?](https://discourse.julialang.org/t/why-is-it-impossible-to-subtype-a-struct/19876):
>
> Is there a deeper reason, why the following does not work? I guess a struct can only be a leaf in the type hierarchy. Is there a reason why this has to be like this? julia\> struct TypeA{T} data::T end julia\> struct TypeB{T} \<: TypeA{T} data::T end ERROR: invalid subtyping in definition of TypeB Edit, I found the follwing in the [Manual](https://docs.julialang.org/en/v1/manual/types/): One particularly distinctive feature of Julia’s type system is that concrete types may not subtype each other: all co…

---

_[View the full topic](https://discourse.julialang.org/t/how-to-enforce-the-fields-to-be-inherited/20693)._
