Colobot Wiki
Advertisement

This keyword is similar to this, however, it grants access to methods from the parent class (see the extends keyword), which is especially useful for method overriding.

Example[]

public class Parent
{
	protected int field;


	void Parent()
	{
		field = 0;
	}


	void Print()
	{
		message("Parent's field: " + field);
	}
}
public class Child extends Parent
{
	private int childsField;


	void Child()
	{
		super.Parent();
		childsField = field + 1;
	}


	void Print()
	{
		super.Print();
		message("Child's field: " + childsField);
	}
}
extern void object::Test()
{
	Child child();
	child.Print(); // Will show both 0 and 1
}

See also[]

Class, this

Programming, types, and categories.

Advertisement