<html><head></head><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1448976633806_53224"><span id="yui_3_16_0_1_1448976633806_53551">Nu mai stiam cum arata testul respectiv, cu i (mic) sau I (mare).</span></div><div id="yui_3_16_0_1_1448976633806_53224"><br></div><div id="yui_3_16_0_1_1448976633806_53224">Deci daca e cu i mic atunci cred ca i-am raspun la intrabarea lui Marius.</div><div id="yui_3_16_0_1_1448976633806_53224"><br></div><div id="yui_3_16_0_1_1448976633806_53224">Consider totusi ca in specificatiile lcpl nu sunt suficiente detalii despre tipul "intregilor fundamentali".</div><div></div><div id="yui_3_16_0_1_1448976633806_53225"> </div> <br><div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: Courier New, courier, monaco, monospace, sans-serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> În Miercuri, 2 Decembrie 2015 13:42:53, Georgiana Diana <geodiana93@gmail.com> a scris:<br></font></div> <br><br> <div class="y_msg_container"><div id="yiv7450369737"><div><div dir="ltr">Din manualul de LCPL:<div>"Numele unei clase este public vizibil in tot programul, nu exista ierarhii
de module. Prin urmare, este o eroare sa aveti doua clase cu acelasi nume
(nu puteti redefini o clasa)."</div><div><br clear="none"></div><div>Nu poti redefini Int.</div><div><br clear="none"></div><div>Oricum, Marius nu cred ca la Int tipul fundamental se refera in exemplele lui. In teste apar exemple cu int (cu i mic) si cred ca la acel int se refera.</div></div><div class="yiv7450369737gmail_extra"><br clear="none"><div class="yiv7450369737gmail_quote">2015-12-02 13:30 GMT+02:00 Maxim Domentii via cpl <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:cpl@cursuri.cs.pub.ro" target="_blank" href="mailto:cpl@cursuri.cs.pub.ro">cpl@cursuri.cs.pub.ro</a>></span>:<br clear="none"><blockquote class="yiv7450369737gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="yiv7450369737yqt8868513665" id="yiv7450369737yqt68943"><div><div style="color:#000;background-color:#fff;font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:16px;"><div>Salut,</div><div><br clear="none"></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;">Daca am :</span><br clear="none" style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><br clear="none" style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;">class Int inherits IntModel ....</span><br clear="none" style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><br clear="none" style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;">Care dintre urmatoarele situatii vor genera erori ?</span><br clear="none"></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><br clear="none"></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;">1. Int x = new IntModel<br clear="none"></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><br clear="none"></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;">Aceasta situatie va genera o erroare intrucat nu poti instantia cu un tip de baza o variabila declarata de un tip derivat.</span><br clear="none"></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;"><br clear="none"></span></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;">2. IntModel y = new Int</span><br clear="none"></span></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><br clear="none"></span></span></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;">Aceasta este situatia care a fost deja lamurita in discutia la care am facut referire si nu va genera o eroare.</span><br clear="none"></span></span></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;"><br clear="none"></span></span></span></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;">3. Int x</span><br clear="none" style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"> IntModel y</span><br clear="none" style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"> if ( x == y )</span><br clear="none"></span></span></span></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;"><br clear="none"></span></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;">Din manualul de lcpl eu inteleg ca operatorul == poate fi folosit pentru a compara doi operanzi de tip:</span></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;">- Int (intregii fundamentali din lcpl)</span></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;">- un intreg si un String</span></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;">- oricare doua obiecte (toate celelalte clase din lcpl deriva din Object).</span></span></div><div dir="ltr"><span style="font-family:'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;"><span style="font-family:'Courier New', courier, monaco, monospace, sans-serif;font-size:16px;"><br clear="none"></span></span></div><div dir="ltr">In cazul de fata, cum IntModel probabil este o clasa derivata din Object (ca toate clasele din lcpl, mai putin intregii) si Int deriva din IntModel, probabil se face o comparatie valida intre doi operanzi care refera obiecte diferite si va intoarce valoarea 0 (false).</div><div dir="ltr"><br clear="none"></div><div dir="ltr">Dar in acest caz probabil ar trebui sa existe o alta discutie. Se poate defini o clasa cu acelasi nume ca si a unui timp de date fundamental din lcpl? Se poate redefini tipul Int? </div><div dir="ltr">Sau poate nu inteleg eu foarte bine specificatiile lcpl, daca sunt complete (in manual se precizeaza despre Int doar ca "intregii sunt un alt tip fundamental; Int nu este o clasa derivata din Object").</div><div dir="ltr"><br clear="none"></div><div dir="ltr">Max</div></div></div></div><br clear="none">_______________________________________________<br clear="none">
cpl mailing list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:cpl@cursuri.cs.pub.ro" target="_blank" href="mailto:cpl@cursuri.cs.pub.ro">cpl@cursuri.cs.pub.ro</a><br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/cpl">http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/cpl</a><br clear="none">
<br clear="none"></blockquote></div><br clear="none"><br clear="all"><div><br clear="none"></div>-- <br clear="none"><div class="yiv7450369737gmail_signature"><div dir="ltr"><font color="#0000ff"><b>Georgiana Diana Ciocirdel</b></font><div>Polytechnic University of Bucharest,</div><div>Computer Science</div></div></div>
</div></div></div><br><br></div> </div> </div> </div></div></body></html>