C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

dynamic_cast

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French)
View previous topic :: View next topic  
Author Message
Etienne Rousee
Guest





PostPosted: Tue Apr 06, 2004 10:28 am    Post subject: dynamic_cast Reply with quote



Bonjour,

Quelqu'un pourrait me dire pourquoi le code suivant:

Composite *Test = dynamic_cast<Composite *> (Avant->_Bloc[i]);

me donne le warning :
warning C4541: 'dynamic_cast' used on polymorphic type 'class
ObjetGraphique' with /GR-;
unpredictable behavior may result

et plante à l'exécution (avec VC++6.0) ?

Où : "Avant" est de type "Composite *"
"Composite" hérite de "ObjetGraphique" qui est abstraite.
"_Bloc" est un attribut de "Composite" et est un Vector de
"ObjetGraphique *".

Et puis je m'en sortir sans rajouter un attribut booléen à "ObjetGraphique"
?

Etienne


Back to top
Twxs
Guest





PostPosted: Tue Apr 06, 2004 10:37 am    Post subject: Re: dynamic_cast Reply with quote



Etienne Rousee wrote:
Quote:
Bonjour,
salut

Quelqu'un pourrait me dire pourquoi le code suivant:

Composite *Test = dynamic_cast<Composite *> (Avant->_Bloc[i]);

me donne le warning :
warning C4541: 'dynamic_cast' used on polymorphic type 'class
ObjetGraphique' with /GR-;

active la gestion des RTTI dans les options de comilation de ton projet
(enable RTTI) il s'agit de l'option /GR- comme te l'indique ton compilateur.


Twxs

Back to top
Etienne Rousee
Guest





PostPosted: Tue Apr 06, 2004 10:53 am    Post subject: Re: dynamic_cast Reply with quote




"Twxs" <Twxs (AT) free (DOT) fr> a écrit ...
Quote:
active la gestion des RTTI dans les options de comilation de ton projet
(enable RTTI) il s'agit de l'option /GR- comme te l'indique ton
compilateur.


Ça marche ! Merci beaucoup.

Etienne



Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.