Concept : Understanding Function and Field Overrides

Page Status: Beta

Back to Concepts and HOW TOs

Contents

[edit] Description

Given the object oriented nature of Bungee Connect, a class that you add to your project extends from a base class named Object and inherits functions and fields (Model code) from Object. By overriding these inherited functions and/or fields, you can customize the behavior of your class. For example, Object's OnCreate function is called when an Object is instantiated, like a constructor. You can override this function to add functionality for initializing your class.

You can also override functions and fields of custom classes you create. For example, you could create a class named Animal, with a function named Speak. Then you could create class Cat that inherits from Animal. Then you could create a function override for Speak in the Cat class. You could add code to the Speak function override so that it returns Meow.

When you override a field, it gives you the opportunity to override that field's Default Value and its OnInit and OnChange handlers. You can also change the field's type to a subclass of the overridden field's type. If the overridden field is of type Data, you can make the override any primitive type or a specific object type.

[edit] See Also

Adding a Function or Field Override
Function
Field
Using OnCreate
OnCreate

[edit] Tags

    Copyright © 2005 - 2007 Bungee Labs. All rights reserved.