<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
<br>Hola a todos, a ver una pequeña duda, soy nueva con esto del dynamic_cast. El compilador me da error pero no entiendo porque, ¿podeis ayudarme?<br><br>codigo:<br><br><font style="" color="#7030a0">bool MyString::operator<=(const ComparableObject& d) const{</font><font style="" color="#7030a0"><br></font><font style="" color="#7030a0">    const MyString& c=dynamic_cast <const ComparableObject&> (d);</font><font style="" color="#7030a0"><br></font><font style="" color="#7030a0">    int i=0; </font><font style="" color="#7030a0"><br></font><font style="" color="#7030a0">    while (st[i]==c.st[i] && st[i++]!='\0');</font><font style="" color="#7030a0"><br></font><font style="" color="#7030a0">    return (st[i]<=c.st[i]); </font><font style="" color="#7030a0"><br></font><font style="" color="#7030a0">}<br><br></font>donde:<br><br><font style="" color="#7030a0">    #ifndef MYSTRING_H</font><font style="" color="#7030a0"><br></font><font style="" color="#7030a0">    #define MYSTRING_H</font><font style="" color="#7030a0"><br></font><font style="" color="#7030a0"><br></font><font style="" color="#7030a0">    #include "ComparableObject.h"</font><font style="" color="#7030a0"><br></font><font style="" color="#7030a0">    class MyString :public ComparableObject{</font><font style="" color="#7030a0"><br></font><font style="" color="#7030a0">      char* st;</font><font style="" color="#7030a0"><br></font><font style="" color="#7030a0">    ...</font><font style="" color="#7030a0"><br></font><font style="" color="#7030a0">    };</font><font style="" color="#7030a0"><br></font><font style="" color="#7030a0">    #endif</font><br><br>El compilador dice:<br><font style="" color="#00b050"><br></font><font style="" color="#00b050">MyString.cc:217: error: invalid initialization of reference of type ‘const MyString&’ from expression of type ‘const ComparableObject’</font><br><br>Muchas gracias de antemano!!!!<br><br /><hr />Comparte hasta 500 fotos en un solo email con  <a href='http://download.live.com/' target='_new'>Windows Live</a></body>
</html>