Inheritance/Single: Difference between revisions

Added Julia language
(Added Julia language)
Line 904:
Julia is not really an object-oriented programming language. It support polymorphism and inheriting functionality but not structure. Thus inheritance hierarchies must be made with abstract types. Abstract types can not be instantiated and do not contain any fields. So below Dog is abstract while Collie is concrete type which may contain fields.
<lang julia>
abstract type Animal end
abstract type Dog <: Animal end
abstract type Cat <: Animal end
 
typestruct Lab <: Dog end
typestruct Collie <: Dog end
</lang>
 
Anonymous user