logical operands on strings

Mike Parker aldacron at gmail.com
Sun Jan 12 18:03:40 PST 2014


On 1/13/2014 3:37 AM, Erik van Velzen wrote:
> On Sunday, 12 January 2014 at 18:28:38 UTC, Meta wrote:
>>
>> It looks like your opBinary on strings is an attempt at globally
>> overriding the XOR operator. I'm almost 100% sure this won't work in
>> D. All operator overloads have to be part of a class or struct.
>
> How would I do that without rewriting an entire string class? It seems I
> can't even inherit from string.

In D, string is not a class. It's an alias for an immutable array of char.



More information about the Digitalmars-d-learn mailing list