Newbie: copy, assignment of class instances
Larry Luther
larry.luther at dolby.com
Thu May 20 13:59:05 PDT 2010
Thank you for the clarifications.
I'm trying to do a shallow copy.
After reading Simen & bearophile, I would add a "copy" member function:
class A {
int x, y;
void copy (in A a) {
x = a.x;
y = a.y;
}
}
class B : A {
int z;
void copy (in B b) {
super.copy( b);
z = b.z;
}
}
B foo = new B,
B bar = new B;
Q: Do I copy the member variables contributed by class A
from "foo" to "bar", this way: "(cast(A) bar).copy( foo);"?
Or maybe "bar.A.copy( foo);"?
Larry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100520/c8ac0d7e/attachment.html>
More information about the Digitalmars-d-learn
mailing list