Yes!

Thats awesome.

Thanks,
Vinuth.


On Thursday, July 23, 2015 at 10:10:04 PM UTC+5:30, Seth wrote:
>
> Is this what you're looking for?
>
> julia> abstract Furniture
>
> julia> type Table <: Furniture end
>
> julia> f{T<:Furniture}(::Type{T}) = 10
> f (generic function with 1 method)
>
> julia> f(Furniture)
> 10
>
> julia> f(Table)
> 10
>
>
>
> On Thursday, July 23, 2015 at 9:34:12 AM UTC-7, Vinuth Madinur wrote:
>>
>> Hi,
>>
>> Is there a way to do function dispatch on subtypes? For example, consider 
>> the following:
>>
>> > abstract Furniture
>>
>> > type Table <: Furniture end
>>
>> > f(::Type{Furniture}) = 10
>>
>> > f(Furniture)
>> 10
>>
>> > f(Table)
>> Error.....
>>
>> How do I enable the same function to be called when I do f(Table)?
>>
>>
>> Thanks,
>> Vinuth.
>>
>>

Reply via email to