Daniel: You are not quite correct. In Juila you can only inherit form "abstract", so you can not write type Animal and inherit from that. "abstract" is used in Base Julia to have a tree of type/immutable so that anyone that creates a Integer type can subtype "Integer" so that methods can easily dispatch on any integer type without having to list them in a "Union(Int,Int32,Int16,Int128,Int8,Uint,Uint32,Uint16,Uint128,Uint8,BigInt)". Updating such a union is quite error prone when new types gets added.
There are a planed feature <https://github.com/JuliaLang/julia/issues/4935>where you can declare fields on a abstract, so that you do not have to write fields and type specifiers on all subtypes. kl. 20:04:05 UTC+1 mandag 23. desember 2013 skrev Daniel Carrera følgende: > > Julia is a fully OOP language, but a different type of OOP than you may be > used to if you are used to C++, Java or Python. Julia doesn't have > classes. Instead, it has types and multiple dispatch. Types can inherit > from other types, and functions can do different things depending on the > type. For example: > > type Animal > ... > end > type Mammal <: Animal > ... > end > type Dog <: Mammal > ... > end > > > function jump(a:::Animal) > # Also defined for sub-types of Animal. > ... > end > function jump(a:::Dog) > # Redefine for dogs. > ... > end > > fido = Dog("fido") > > jump(fido) > > > Cheers, > Daniel. > > On Monday, 23 December 2013 06:58:18 UTC-5, sina kashi pazha wrote: >> >> hello >> >> I'm new user and I want to know Julia provide object oriented programming? >> forgive me because of this stupid question. >> >>
