You can only inherit from abstract types.  Also, first defining

type number
...
end

and then

abstract number

is not possible.  It cannot be both abstract and concrete.  (Also note
that types are by convention Captialized).

So build your hierarchy only with abstract types and make concrete types
of some of the abstract ones.

On Tue, 2016-03-22 at 15:26, kunal singh <ks250...@gmail.com> wrote:
> So basically there is a type called Basic defined as follows
>
> type Basic
>   ptr::Ptr{Void}
>   function Basic()
>     z = new(C_NULL)
>     ccall((:basic_new_stack, :libsymengine), Void, (Ptr{Basic}, ), &z)
>     finalizer(z, basic_free)
>     return z
>   end
> end
>
> Now I want to create a hierarchy: integer(not Integer)< number(not Number) <
> Basic
>
> But in Julia, we cannot inherit from concrete type So what should I Do??
>
> Here's My approach
>
> abstract Basic
>
> type number <: Basic
>   ptr::Ptr{Void}
>   function number()
>     z = new(C_NULL)
>     ccall((:basic_new_stack, :libsymengine), Void, (Ptr{Basic}, ), &z)
>     finalizer(z, basic_free)
>     return z
>   end
> end
>
> abstract number
>
> type integer <: number
>   ptr::Ptr{Void}
>   function integer()
>     z = new(C_NULL)
>     ccall((:basic_new_stack, :libsymengine), Void, (Ptr{Basic}, ), &z)
>     finalizer(z, basic_free)
>     return z
>   end
> end
>
>
> Please tell me if I am wrong ?
> Need help from

Reply via email to