21 Aug 00:56
Generic solution for inheritance?
From: Stephen R. van den Berg <srb <at> cuci.nl>
Subject: Generic solution for inheritance?
Newsgroups: gmane.comp.lang.pike.user
Date: 2008-08-20 22:58:26 GMT
Subject: Generic solution for inheritance?
Newsgroups: gmane.comp.lang.pike.user
Date: 2008-08-20 22:58:26 GMT
Given two classes:
class d {
int a;
int b(int c) {
a=c;
}
void create() {
}
}
class e {
inherit d;
int f;
void create() {
::create();
}
int g(int h) {
f=h;
}
}
e getnew() {
d k=d();
e m=k; // doesn't work, will force the object to be of class d
return m;
}
Now, without knowing the complexity and/or content of class d and
(Continue reading)
.
Still is doesnt seem too hard to implement Stdio.File()->assign()
generically. Simply iterate all object variables and try to
assign them to the new object. Only problem is that you cannot replace
all the references to the old object easily.
arne
On Thu, 21 Aug 2008, Stephen R. van den Berg wrote:
> Given two classes:
>
> class d {
> int a;
> int b(int c) {
> a=c;
> }
> void create() {
> }
> }
>
> class e {
> inherit d;
RSS Feed