Hi, You can "disguise" method calls into variables by using the @property tag.
interface Sizeable
{
// Getter
@property int size();
// Setter
@property int size(int s);
}
class A : Sizeable
{
int m_size;
public:
this()
{
}
@property int size() { return m_size; }
@property int size(int s) {return m_size = s; }
}
static void main(string[] args)
{
A a = new A();
a.size = 20; // calls a.size(int);
int i = a.size + 10; // calls a.size()
}
Cheers,
Olivier.
