o.xx is not a variable name, its an expression which gets the content of the key xx in o. Use setCapacity for an object's fields. If you want to initialise the memory to zero, you can use eg, globalAlloc.

Helgef wrote:o.xx is not a variable name, its an expression which gets the content of the key xx in o. Use setCapacity for an object's fields. If you want to initialise the memory to zero, you can use eg, globalAlloc.

Cheers.

I understood o.xx is an expression which gets the content of the key xx in o.but field of class = key of object in Autohotkey????

Actually, I tend to use built-in functions(eg. VarSetCapacity) rather than DllCall(eg. GlobalAlloc)...thank you for replying.

Autohotkey uses prototype based inheritance, everything is a key of object or a key of the base(prototype) object or the key of the base of the base object... This includes constructors, destructors, properties, meta properties...In Autohotkey "field of class" is just a key that is added in the auto generated __Init method, this method is called before the constructor(__New) when you use the new keyword.

A class in Autohotkey is not really a class but just syntactic sugar for the following:

If you are coming from languages with "real" classes that use class based inheritance like Java, c# or c++ this might seem strange but you will get used to it.You should thoroughly read https://autohotkey.com/docs/Objects.htm#Custom_Objects it's probably the most difficult documentation page in Autohotkey but it's very well explained.