What is equivalent to class extend in Julia?

What’s equivalent to this:
(This is 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?

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”.

1 Like

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

For instance this: Composition and inheritance: the Julian way - #3 by rdeits