How do I call super or object.opAssign for classes?
Steven Schveighoffer
schveiguy at yahoo.com
Tue Jul 26 05:54:55 PDT 2011
On Tue, 26 Jul 2011 07:54:54 -0400, Diego Canuhé <canuhedc at gmail.com>
wrote:
> Hi,
> isn't that the way it's supposed to work? I mean
>
> void show(int a) { writeln(a); }
>
> void main() { show(null); }
>
> won't compile either.
> Shouldn't bar be some kind of pointer?
null should be considered as the type of the class, not void *. You
should not be able to override the behavior of opAssign as it pertains to
assigning to a class instance. In other words, you should *never* be able
to override x = null where x is a class instance.
>
> btw, today I read "opAssign can no longer be overloaded for class
> objects"
> here:
>
> http://www.d-programming-language.org/features2.html
>
> is that no longer valid?
Here is the spec. I would not trust that features2, it's probably out of
date.
http://www.d-programming-language.org/operatoroverloading.html#Assignment
-Steve
More information about the Digitalmars-d-learn
mailing list