Extending functions in subclasses (Newbie)

hi,

what i would like to to is have a parent class which lets say does eat and drink inside the function OnTriggerEnter.

And a subclass via class Child extends Parent {}, which does eat and drink and pay inside the same OnTriggerEnter, but, as being a subclass, only add the function pay to it.

How can i do that? Having a pay inside OnTriggerEnter will override the eat and drink from the parent, which i of course would like to keep, hence the whole inheritance thing.

Thanks,
Aksel

Sigh, think i found it and will answer my own post now:

/* Parent.js */
function OnTriggerEnter() {
Eat();
Drink();
}

/* Child.js */
class Child extends Parent {}
function OnTriggerEnter() {
super.OnTriggerEnter()
Pay();
}

Is that a good approach or is there a better one?

Thanks again,
A.