Ref and class function calls?
Tofu Ninja
emmons0 at purdue.edu
Mon Apr 15 22:37:46 PDT 2013
I could not think of what to call this because I don't know if it
has a name to call it by.
Basicly what I was wondering is if their was a way in D to make a
class function pass the object being called on by reference.
might be easier to show code, basically I want something like
this to be possible
class A
{
//some how signify that this function passes 'this' by
reference
public void replace()
{
this = new A();
}
}
...
A a = new A();
A b = a;
b.replace();
assert(b != a);
I don't know if I am being clear or if their is something better
to call this.
Thanks for the help
Tofu
More information about the Digitalmars-d-learn
mailing list