Theory question
BCS
ao at pathlink.com
Thu May 21 15:57:02 PDT 2009
Are there any cases where the following cases both compile but are not identical?
A a;
B b;
a = b;
a.Foo();
//// and
A a;
B b;
a = b;
b.Foo();
The reason I ask is I'm wondering if making the type (and value) of an assignment
expression the right hand side rather than the left hand side would silently
break code. It would be handy for cases like this because it avoids the need
for a temp variable:
class C { }
class D : C { int i();}
D newD();
C c;
void main()
{
(c = newD()).i();
}
More information about the Digitalmars-d-learn
mailing list