# Calling an overridden function in an overriding function

**URL:** <https://discourse.julialang.org/t/calling-an-overridden-function-in-an-overriding-function/37196>\
**Category:** General Usage\
**Created:** [April 7, 2020, 9:03pm UTC](https://discourse.julialang.org/t/calling-an-overridden-function-in-an-overriding-function/37196 "2020-04-07T21:03:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wsshin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsshin/32/360_2.png) [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Post date:** [April 7, 2020, 9:03pm UTC](https://discourse.julialang.org/t/calling-an-overridden-function-in-an-overriding-function/37196/1 "2020-04-07T21:03:47Z")

</div>

Suppose a function is defined for an abstract type (say `AbstractMyType`), and it is overridden for a concrete subtype (say `MyType<:AbstractMyType`). The overriding function does extra work on top of the work implemented in the overridden function, so I would like to call the overridden function inside the overriding function. Is this possible?

The following code describes what I would like to achieve:

```julia
abstract type AbstractMyType end

function myfun(x::AbstractMyType) # function to be overridden below
   ...
end

struct MyType<:AbstractMyType
   ...
end

function myfun(x::MyType) # override above function
    myfun(x::AbstractMytype) # this line is something I want to achieve

    # Do more work
    ...
end

```

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [April 7, 2020, 9:11pm UTC](https://discourse.julialang.org/t/calling-an-overridden-function-in-an-overriding-function/37196/2 "2020-04-07T21:11:11Z")

</div>

You are probably looking for `invoke`.
