adding properties/methods to AA's?

Alex CppCoder at gmail.com
Sun Jul 22 22:37:52 PDT 2007


Ok, so I've got a property (I guess that's the proper term to use?) that I'd like to be able to use with any AA declared as Variant[char[]].  For example, I'd like to be able to do the following.

Variant[char[]] map;
ubyte []stream;

stream = map.serialize;
map.deserialize( stream );

int [int[]] map2;
stream = map.serialize; //invalid, int [int[]] does not have serialize property.

Is this even possible?  I'm sure someone will tell me to just write a function such as ubyte []serialize( Variant[char[]]input ), and I'm aware this is an option.  I just think the above looks a bit more slick.


More information about the Digitalmars-d-learn mailing list