**Mail Archives: djgpp/1995/07/26/07:30:43**
(1) How can I (say) declare a class of 8 bytes, the first 4 bytes are a
long, the other 4 bytes are a function entry address? If I write:-
class qaz{long code; double fn(double); ......};
qaz Sin, Cos, Exp, *q; double x;
Sin.code=1; Cos.code=2; Exp.code=3;
Sin.fn=sin; Cos.fn=cos; Exp.fn=exp;
q->fn(x);
I of course go hopelessly astray.
(2) If I declare:-
class qwerty{public: int q,w,e,r,t,y; ...........};
class qwertyuiop : public qwerty{int u,i,o,p; .............};
qwertyuiop Q; qwerty*W;
how can I set `W' to point to the `qwerty' value which is within the
`qwertyuiop' value `Q'?
(3) If I write e.g. `double (fn*)(double);', then `fn' can contain the entry
address of sin() or cos() or exp() or any other function of that argument and
result pattern which is not a class member. If I then declare:-
class zoo{public: ...........
double yak(double x){................};
double gnu(double x){................};
double gaur(double x){................};
double duiker(double x){................};
double eland(double x){................};......};
how can I declare a pointer variable that can point to any one of the five
above-declared functions?
double (ruminant*)(double);
looks a likely starting point, but I likely need to insert `zoo.' or `zoo->'
or `zoo::' somewhere in it. Or would this work?:-
double (ruminant*)(zoo&,double);
Once I have done that, would this work?:-
ruminant = zoo::yak;

*- Raw text -*