The problem comes down to the following:
class A {
int i;
};
class B : public A {
char *p;
public:
static B& castdown(A& p) { return (B&)p; } // error
static B* castdown(A* p) { return (B*)p; }
};
G++ lets me cast a pointer but I get the following message if I try to
downcast a reference:
t.c: In function class B &static B::castdown (class A &):
t.c:8: type `B' is not a base type for type `A'
The NIH class library uses such downcasts. How can I get g++ to accept
a downcast of a reference??
Richard Emberson
r...@spl26.spl.fac.com