How to call function on base class?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Zylann
:warning: Old Version Published before Godot 3 was released.
extends "cannon_base.gd"

# Override
func catch(avatar):
	# How can I call the base function from cannon_base?
:bust_in_silhouette: Reply From: Hinsbart

From GDScript reference — Godot Engine (latest) documentation in English

To call a function in a base class (i.e. one extend-ed in your current class), prepend . to the function name:
.basefunc(args)

So it’s

func catch(avatar):
    .catch(avatar)

Beware the note on that docs page:

Default functions like _init, and most notifications such as _enter_tree, _exit_tree, _process, _physics_process, etc. are called in all parent classes automatically. There is no need to call them explicitly when overloading them.

idbrii | 2022-12-23 00:41

This information is all accurate for Godot 3, but in Godot 4 this information has changed.

From https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html:

To call a function in a super class (i.e. one extend-ed in your current class), use the super keyword:

super(args)

Additionally in Godot 4, default functions are no longer called in all parent classes automatically. You must call them explicitly when overloading them.

Poobslag | 2023-06-19 14:01