<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_35715" class="">Salut,</div><div id="yui_3_16_0_1_1448976633806_35715" class=""><br id="yui_3_16_0_1_1448976633806_38718" class=""></div><div id="yui_3_16_0_1_1448976633806_35715" dir="ltr" class=""><span id="yui_3_16_0_1_1448976633806_35857" class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;">Daca am :</span><br id="yui_3_16_0_1_1448976633806_35859" class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"><br id="yui_3_16_0_1_1448976633806_35861" class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"><span id="yui_3_16_0_1_1448976633806_35863" class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;">class Int inherits IntModel ....</span><br id="yui_3_16_0_1_1448976633806_35865" class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"><br id="yui_3_16_0_1_1448976633806_35867" class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"><span id="yui_3_16_0_1_1448976633806_35869" class="" 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 id="yui_3_16_0_1_1448976633806_38728" class=""></div><div id="yui_3_16_0_1_1448976633806_35715" dir="ltr" class=""><span class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_38731"><br id="yui_3_16_0_1_1448976633806_38733" class=""></span></div><div id="yui_3_16_0_1_1448976633806_35715" dir="ltr" class=""><span class="" id="yui_3_16_0_1_1448976633806_36097" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;">1. Int x = new IntModel<br id="yui_3_16_0_1_1448976633806_38737" class=""></span></div><div id="yui_3_16_0_1_1448976633806_35715" dir="ltr" class=""><span class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_38740"><br id="yui_3_16_0_1_1448976633806_38742" class=""></span></div><div id="yui_3_16_0_1_1448976633806_35715" dir="ltr" class=""><span class="" id="yui_3_16_0_1_1448976633806_36118" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"><span id="yui_3_16_0_1_1448976633806_36099" class="" 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 id="yui_3_16_0_1_1448976633806_38747" class=""></span></div><div id="yui_3_16_0_1_1448976633806_35715" dir="ltr" class=""><span class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"><span class="" style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 16px;"><br></span></span></div><div id="yui_3_16_0_1_1448976633806_35715" dir="ltr" class=""><span class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_38872"><span class="" style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 16px;" id="yui_3_16_0_1_1448976633806_38871"><span style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_38870" class="">2. IntModel y = new Int</span><br></span></span></div><div id="yui_3_16_0_1_1448976633806_35715" dir="ltr" class=""><span class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"><span class="" 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;" class=""><br></span></span></span></div><div id="yui_3_16_0_1_1448976633806_35715" dir="ltr" class=""><span class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_38892"><span class="" style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 16px;" id="yui_3_16_0_1_1448976633806_38891"><span style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" class="" id="yui_3_16_0_1_1448976633806_38890"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 16px;" id="yui_3_16_0_1_1448976633806_38875" class="">Aceasta este situatia care a fost deja lamurita in discutia la care am facut referire si nu va genera o eroare.</span><br></span></span></span></div><div id="yui_3_16_0_1_1448976633806_35715" dir="ltr" class=""><span class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"><span class="" 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;" class=""><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 16px;" class=""><br></span></span></span></span></div><div id="yui_3_16_0_1_1448976633806_35715" dir="ltr" class=""><span class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_38917"><span class="" style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 16px;" id="yui_3_16_0_1_1448976633806_38916"><span style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" class="" id="yui_3_16_0_1_1448976633806_38915"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 16px;" class="" id="yui_3_16_0_1_1448976633806_38914"><span style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_38905" class="">3. Int x</span><br style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_38907" class=""><span style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_38909" class=""> IntModel y</span><br style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_38911" class=""><span style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_38913" class=""> if ( x == y )</span><br></span></span></span></span></div><div dir="ltr" id="yui_3_16_0_1_1448976633806_38749" class=""><span class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_38751"><span class="" style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 16px;" id="yui_3_16_0_1_1448976633806_38753"><br id="yui_3_16_0_1_1448976633806_38755" class=""></span></span></div><div dir="ltr" id="yui_3_16_0_1_1448976633806_38749" class=""><span class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_40337"><span class="" style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 16px;" id="yui_3_16_0_1_1448976633806_40336">Din manualul de lcpl eu inteleg ca operatorul == poate fi folosit pentru a compara doi operanzi de tip:</span></span></div><div dir="ltr" id="yui_3_16_0_1_1448976633806_38749" class=""><span class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_40680"><span class="" style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 16px;" id="yui_3_16_0_1_1448976633806_40679">- Int (intregii fundamentali din lcpl)</span></span></div><div dir="ltr" id="yui_3_16_0_1_1448976633806_38749" class=""><span class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"><span class="" style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 16px;">- un intreg si un String</span></span></div><div dir="ltr" id="yui_3_16_0_1_1448976633806_38749" class=""><span class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;" id="yui_3_16_0_1_1448976633806_40682"><span class="" style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 16px;" id="yui_3_16_0_1_1448976633806_40681">- oricare doua obiecte (toate celelalte clase din lcpl deriva din Object).</span></span></div><div dir="ltr" id="yui_3_16_0_1_1448976633806_38749" class=""><span class="" style="font-family: 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"><span class="" style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 16px;"><br></span></span></div><div dir="ltr" id="yui_3_16_0_1_1448976633806_38749" class="">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" id="yui_3_16_0_1_1448976633806_38749" class=""><br></div><div dir="ltr" id="yui_3_16_0_1_1448976633806_38749" class="">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" id="yui_3_16_0_1_1448976633806_38749" class="">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" id="yui_3_16_0_1_1448976633806_38749" class=""><br></div><div dir="ltr" id="yui_3_16_0_1_1448976633806_38749" class="">Max</div></div></body></html>