On Thursday, 10 November 2016 at 16:44:24 UTC, Satoshi wrote:
But this implementation of dup doesn't work.
The dup will need to be a virtual function in the base class for
best results, reimplemented in each child class.
You could also copy the bytes using runtime type info...
Hello,
how can I copy class when I have pointer to the parent of it?
eg.
class Foo {
int m_a;
this(const(Foo) other) {
m_a = other.m_a;
}
}
class Bar : Foo {
int m_b;
this(const(Bar) other) {
super(other);
m_b = other.m_b;
}
R dup(this