<div><span style="font:12px/24px Monaco, Menlo, Consolas, 'Courier New', monospace;text-align:justify;color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;float:none;display:inline;white-space:pre-wrap;background-color:rgb(245,245,245);"><span style="font:12px/24px Monaco, Menlo, Consolas, 'Courier New', monospace;text-align:justify;color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;float:none;display:inline;white-space:pre-wrap;background-color:rgb(245,245,245);"> String x = "xyz";<br> C.m( x );<br> System.out.println ( x );<br><br> class C {<br> static void m( String y ) {<br> y = "123";<br> }<br><br> }</span></span></div> <div><span style="font:12px/24px Monaco, Menlo, Consolas, 'Courier New', monospace;text-align:justify;color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;float:none;display:inline;white-space:pre-wrap;background-color:rgb(245,245,245);"></span> </div> <div><span style="font:12px/24px Monaco, Menlo, Consolas, 'Courier New', monospace;text-align:justify;color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;float:none;display:inline;white-space:pre-wrap;background-color:rgb(245,245,245);"> string xyz = "xyz";<br> string& x = xyz;<br> m( x );<br> cout << x;<br><br> void C::m ( string& y ) {<br> y = "123";<br> }</span></div> <div><span style="font:12px/24px Monaco, Menlo, Consolas, 'Courier New', monospace;text-align:justify;color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;float:none;display:inline;white-space:pre-wrap;background-color:rgb(245,245,245);"></span> </div><span style="font:12px/24px Monaco, Menlo, Consolas, 'Courier New', monospace;text-align:justify;color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;float:none;display:inline;white-space:pre-wrap;background-color:rgb(245,245,245);"> </span><div style="font:16px/1.8 'Open Sans', Helvetica, Arial, 'Nimbus Sans L', sans-serif;margin:0px 0px;padding:0px;border:0px;text-align:justify;color:rgb(51,51,51);text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;vertical-align:baseline;white-space:normal;background-color:rgb(255,255,255);">Java 예의 결과는 xyz이지만, C++ 예의 결과는 123이다.</div> <div style="font:16px/1.8 'Open Sans', Helvetica, Arial, 'Nimbus Sans L', sans-serif;margin:0px 0px;padding:0px;border:0px;text-align:justify;color:rgb(51,51,51);text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;vertical-align:baseline;white-space:normal;background-color:rgb(255,255,255);">[질문] 유사해 보이는 두 프로그램의 결과가 다른 이유를 설명하시오.<br>[질문] C++ 코드에서 string xyz = "xyz" 문장을 없애고 string&x = xyz를 Java 코드와 더 유사하게 string& x = "xyz"로 바꾸면 어떤 문제가 발생할까?</div> <div>두가지 답좀 알려주시면 감사하겠습니다.</div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.