Xref: news2.mv.net comp.os.msdos.djgpp:7909 From: david DOT faure AT bbsrc DOT ac DOT uk (David Faure) Newsgroups: comp.os.msdos.djgpp Subject: Bug in lang/cxx/streambu.h Date: 26 Aug 1996 18:38:47 GMT Organization: BBSRC Lines: 51 Message-ID: <4vsqvn$5nk@is.bbsrc.ac.uk> NNTP-Posting-Host: pc0570.sri.bbsrc.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Hello everybody. I found that a #include is missing in lang/cxx/streambu.h. [note to D.J. : please update if you agree with that assumption] If you want to know why, test this code : [about trying to know which type is a class-variable] /* add flag -frtti when compiling */ /* and -lstdcx when linking or library "stdcx" under RHIDE*/ #include #include // required according to documentation class A { public: A() {} virtual void foo() {cout << "called class A.foo()\n";} void nonv() {cout << "non virtual called. ok.";} }; class B : public A { // so we can get A's Ctor void foo() { cout << "called class B.foo()\n"; } }; int main() { A *AVar = new A; A *BVar = new B; // test for a vs b type if(typeid(B) == typeid(*BVar)) cout << "BVar is a B\n"; if(typeid(A) == typeid(*BVar)) cout << "BVar is an A\n"; if(typeid(B) == typeid(*AVar)) cout << "AVar is a B\n"; if(typeid(A) == typeid(*AVar)) cout << "AVar is an A\n"; // dynamic cast BVar to A A* Acast = dynamic_cast(BVar); if(typeid(B) == typeid(*Acast)) cout << "Acast is B\n"; if(typeid(A) == typeid(*Acast)) cout << "Acast is A\n"; // just to show they work... AVar->foo(); BVar->foo(); AVar->nonv(); return 0; } David Faure email : david DOT faure AT bbsrc DOT ac DOT uk until 30/08/96 (summer job) please mail to : alain AT ctrsol1 DOT avignon DOT inra DOT fr after 30/08/96. Thanks.