Topic: irtual Base Class Question, Please Help!
Author: grumpy@cbnewse.cb.att.com (Paul J Lucas)
Date: Sun, 26 Sep 1993 16:03:47 GMT Raw View
Author: jchou@wilbur.nas.nasa.gov (Jin J. Chou)
Date: Thu, 23 Sep 1993 15:49:39 GMT Raw View
I ran into some problems in using virtual base class.
Helps are appreciated. SGI C++ 3.0.1 gives fatal error
when I cast the pointer of a derived class to a pointer
of its virtual base class. What does ANSI C++ say about
this?
For example, the following does not compile. Is this a
problem of this specific compiler?
--------------
class base {};
class deriveL1A : virtual public base {};
class deriveL1B : virtual public base {};
class deriveL2 : public deriveL1A, public deriveL1B {};
int main() {
deriveL1A d;
base* b = &d;
deriveL1A* c = (deriveL1A*) b;
}
--------------
Thanks in advance.