forward-declare class B as being derived from class A
Posted on 2002-04-19
I want to do something, like:
class B : public A;
That is: I want to forward-declare Type B, but
let the compiler know, that B is derived from A.
However, the Compiler (or even C++-spec)
doesn't seem to accept this.
The reason, I'd need it is:
In some part of my prog, I'm using only
pointers to these classes, and I want to pass
a B* to a method that takes a const A*
(without casting, and without #include'ing
the real definition of B)
Sounds not too far off, does it ?
The Compiler I need it for (if that should make
a difference) is SUN's Forte WS6U2.
This question is quite important to me, therefore
I won't accept simple "won't go"-answers unless
they also point out, *why* this would be impossible or
what trouble this would inevitably put me into.