Monkey2 – Extensions keyword

Just discovered this new ‘feature’ in the Monkey2 language!

Of course it’s not really new (just re-read the Mark’s post on September 5th, 2016… ehm! – I really missed this!)

But it is very .., HANDY!

Imagine this: you have a Class already defined. Without change the main class (or create a new one using Class MyClass Extend Class) you could use this magic keyword

and then in your code use

So basically it’s possible the simplify code or resolve problem without changing everything from scratch or making derived class!

It is used to ‘link’ with external code (just see the source code of Monkey2 in many library like Bullet, JSon etc)

Officially – from Mark’s post – Class extensions allow you to add non-virtual methods (and other members except fields) to an existing class

Here you can read a bit more ‘useful’ example !

local_offerevent_note October 22, 2017

account_box degac


local_offer

Leave a Reply

Your email address will not be published.