# What is equivalent to class extend in Julia?

**URL:** <https://discourse.julialang.org/t/what-is-equivalent-to-class-extend-in-julia/15667>\
**Category:** General Usage\
**Tags:** question\
**Created:** [September 29, 2018, 2:51pm UTC](https://discourse.julialang.org/t/what-is-equivalent-to-class-extend-in-julia/15667 "2018-09-29T14:51:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheOnlyArtz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/theonlyartz/32/12685_2.png) [@TheOnlyArtz](https://discourse.julialang.org/u/TheOnlyArtz)\
**Post date:** [September 29, 2018, 2:51pm UTC](https://discourse.julialang.org/t/what-is-equivalent-to-class-extend-in-julia/15667/1 "2018-09-29T14:51:32Z")

</div>

What’s equivalent to this:  
(This is javascript):

```javascript
class B extends classA {
  constructor() {
    super() // all the functions available in class A will be available for here without the need to write them again
  }
}

```

but in Julia?

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [September 29, 2018, 3:07pm UTC](https://discourse.julialang.org/t/what-is-equivalent-to-class-extend-in-julia/15667/2 "2018-09-29T15:07:26Z")

</div>

In Julia only abstract types have subtypes. As the documentation says:

**Abstract types cannot be instantiated, and serve only as nodes in the type graph, thereby describing sets of related concrete types: those concrete types which are their descendants. We begin with abstract types even though they have no instantiation because they are the backbone of the type system: they form the conceptual hierarchy which makes Julia’s type system more than just a collection of object implementations.**

So there is no `super()`. Instead of inheritance one can use composition. There have been quite a few discussions of how to design hierarchies of types on this forum already. Search for “inheritance”.

---

<div class="post-metadata">

**Author:** ![TheOnlyArtz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/theonlyartz/32/12685_2.png) [@TheOnlyArtz](https://discourse.julialang.org/u/TheOnlyArtz)\
**Post date:** [September 29, 2018, 3:10pm UTC](https://discourse.julialang.org/t/what-is-equivalent-to-class-extend-in-julia/15667/3 "2018-09-29T15:10:04Z")

</div>

Can you please provide a little example just so I can get the hang of it?

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [September 29, 2018, 3:13pm UTC](https://discourse.julialang.org/t/what-is-equivalent-to-class-extend-in-julia/15667/4 "2018-09-29T15:13:10Z")

</div>

For instance this: [Composition and inheritance: the Julian way - #3 by rdeits](https://discourse.julialang.org/t/composition-and-inheritance-the-julian-way/11231/3)
