How do you overload opEquals?

Adam D. Ruppe destructionator at gmail.com
Tue Nov 19 16:04:40 PST 2013


On Tuesday, 19 November 2013 at 23:58:20 UTC, Andrea Fontana 
wrote:
> And, of course, struct are value type, class are reference type.

Yeah, true in general, though it is possible to have a struct be 
very similar to a reference type. Consider:

struct WrappedClass {
    Object obj;
    /* and whatever other methods, but no more data */
}

It's still a value type, but the only member is a reference, so 
you can use it the same way as any other reference type; it works 
the same way as Object itself.

So struct is flexible in the value vs reference type regard too.


More information about the Digitalmars-d-learn mailing list