dynamic_cast

Sebastian Huber sebastian-huber@web.de
Sat Feb 16 06:23:00 GMT 2002


Hello,
why does the following code fragment not work?

class Storable { };

class Component : virtual public Storable { };

int main()
{
	Storable* s = new Component();
	Component* c = dynamic_cast<Component*>( s);
	delete s;

	return 0;
}

This code is very similar to an example of Bjarne Stoupstrup.
I use g++ version 2.95.3.



More information about the Gcc-help mailing list