How to override base class functions in Java Script

I have a base class called “Mode” and I create a class called “NewMode” which extends off of “Mode”. “Mode” simply has a bunch of empty functions in it. I want to override these functions in “NewMode”.

static var CurrentMode: Mode;
static var CurrentObject: GameObject;

function Start()
{
	CurrentObject = GameObject.Find("SomeObject");
	if(CurrentObject != null)
	{
		CurrentMode = CurrentObject.GetComponent(NewModeScript);	
		CurrentMode.Enter();
	}
}

NewModeScript contains the “NewMode” class. When I call CurrentMode.Enter() the empty function of the base class gets called.

Try adding the virtual keyword in front the functions that get overridden.

virtual function DoSomething ()
{
}

Thanks.