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 !

Leave a Reply

Your email address will not be published.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close