ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/02/20/05:30:32

To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Problems with type cast of a class reference
Date: Thu, 20 Feb 92 11:16:00 N
From: tw AT fgb1 DOT fgb DOT mw DOT tu-muenchen DOT de
Status: O

The following short program taken from

"The annotated C++ reference manual"

page 69 doesn't work with g++. 

/*********************************************/
class B {/*..........*/};

class D : public B {/*............*/};



void f(B& rb)
      {
      //.............
      D&rd = (D&) rb;
      //.............
      }


main()
{
void f(B&);
}
/*********************************************/


I think that's essential for building class hierarchies, 
so we possibly missed something (it works with Borland C++).

What's wrong with it (or possibly with us :-))?

Thomas Wuensche

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019