You need to research abstracts
http://haxe.org/manual/types-abstract.html
> run operators on directly, like Int.
http://haxe.org/manual/types-abstract-operator-overloading.html
Just be mindful of checking what the abstract converts to in terms of
inline functions etc... in your target, and don't expect perfection
abstracts can be a bit weird.
Best Justin
On 02/08/2015 14:17, Sami Habib wrote:
> Is it possible to somehow create my own data types? For example, say I
> wanted to make UInt8 that can only hold 8-bit positive integers, from
> 0 to 255, which wraps around if it goes over. Could I somehow extend
> Int so that it does "& 0xFF" with any value it's given?
>
> I understand that I would be able to make some class and make stuff
> like setters and getters, but it would be nice to have a proper data
> type that I can just
>
> Can I do this, and if so how?
> --
> To post to this group
haxe...@googlegroups.com
>
http://groups.google.com/group/haxelang?hl=en
> ---
> You received this message because you are subscribed to the Google
> Groups "Haxe" group.
> For more options, visit
https://groups.google.com/d/optout.