Can I 'force' a specific method to be called?

Hi,

Consider the following:

abstract type FooBase end

bar(f::FooBase) = 1

struct Foo <: FooBase
counter::Integer
end

function bar(f::Foo)
f.counter += bar(f) # I want to call bar(f::FooBase) here
end

Can I somehow tell Julia that I want to call the first method instead of the more specific second method?

Thanks in advance,
Stef

Yes, you want ot use invoke

5 Likes