# Multiple dispatch: Force to use some certain method

**URL:** <https://discourse.julialang.org/t/multiple-dispatch-force-to-use-some-certain-method/10274>\
**Category:** General Usage\
**Created:** [April 11, 2018, 9:02am UTC](https://discourse.julialang.org/t/multiple-dispatch-force-to-use-some-certain-method/10274 "2018-04-11T09:02:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iagoba\_Apellaniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iagoba_apellaniz/32/34406_2.png) [@Iagoba\_Apellaniz](https://discourse.julialang.org/u/Iagoba_Apellaniz)\
**Post date:** [April 11, 2018, 9:02am UTC](https://discourse.julialang.org/t/multiple-dispatch-force-to-use-some-certain-method/10274/1 "2018-04-11T09:02:20Z")

</div>

Is there any way to force the multiple dispatch system to use certain method instead of the less ambiguous one?

Here is a naive example

```julia
abstract type MyAbstract end

struct MyType1 <: MyAbstract 
    x::Int
end

struct MyType2 <: MyAbstract
    x::Float64
end

function foo(x::MyAbstract, y::MyAbstract)
    MyType2(x.x + x.y)
end

function foo(x::T, y::T) where T<:MyAbstract
    print("They were the same type!")
    foo(x::MyAbstract, y::MyAbstract) # This doesn't work yet
end

```

Thanks!

---

<div class="post-metadata">

**Author:** ![thofma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thofma/32/1691_2.png) [@thofma](https://discourse.julialang.org/u/thofma)\
**Post date:** [April 11, 2018, 9:13am UTC](https://discourse.julialang.org/t/multiple-dispatch-force-to-use-some-certain-method/10274/2 "2018-04-11T09:13:15Z")

</div>

Invoke:  
[https://docs.julialang.org/en/stable/stdlib/base/#Core.invoke](https://docs.julialang.org/en/stable/stdlib/base/#Core.invoke)

---

<div class="post-metadata">

**Author:** ![djsegal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djsegal/32/13752_2.png) [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Post date:** [April 11, 2018, 9:38pm UTC](https://discourse.julialang.org/t/multiple-dispatch-force-to-use-some-certain-method/10274/3 "2018-04-11T21:38:20Z")

</div>

That’s a good question!

I think some languages would call this the **`super`** function:

> **[super - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/super)**
>
> The super keyword is used to access properties on an object literal or class's \[\[Prototype\]\], or invoke a superclass's constructor.
