3 ms·
Gosu supports a property syntax that lets you use = to assign things to get/set method pairs. In fact, when you load existing Java code, it replaces getFoo() an
by tikhonj 15y ago
Gosu supports a property syntax that lets you use = to assign things to get/set method pairs. In fact, when you load existing Java code, it replaces getFoo() and setFoo(foo) methods with a property.
This makes the code neater and enforces the abstraction--the user of the property does not need to know whether you've implemented it as a simple variable or a complicated method.
A bunch of other language let you do this as well.
- haldean 15y agoPython can do this: http://docs.python.org/library/functions.html#property http://docs.python.org/library/functions.html#property