Virtual methods and overriding

How can I get a script to override a class with a function? Let’s start with a main script of pets.

Now let’s create a Duck script. We want to change the speak from “speak” to “quack quack”. How do we do this? We change the function to virtual!

Now inside my duck script, if I use protected override vs public, I can override the pet class function Speak().

Doing this, we can use inheritance to override any function as long as it has the virtual placed in the method name.