Skip to content
Matthew edited this page Sep 5, 2016 · 5 revisions

Extension methods allow you to add a function to a struct or a trait after it is already defined.

struct B
{
    int b_val;
}

fun void B::Extension()
{
	printf("pass", 0);
}

Once you define it, it can be used just like any other member function.

let x = B();
x.Extension();
Clone this wiki locally