<div> public class Test</div> <div> {</div> <div> public int a;</div> <div> public string str;</div> <div> }</div> <div><br></div> <div>사용자 클래스를 만들고 </div> <div> Test[,] t = new Test[5, 5]; 을 만든 후 </div> <div> <div> //t[0, 0].a = 10; err</div> <div> //t[0, 0].str = "Test"; err</div></div> <div><br></div> <div>에러가 납니다.</div> <div>t[0,0] = new Test(); 하고 난 뒤 사용합니다.</div> <div><br></div> <div>마치</div> <div><br></div> <div> Test[,] t = new Test[5, 5]; 에서 포인터같은 것을 5x5 로 만들어 놓고</div> <div><br></div> <div> <span style="font-size:9pt;line-height:1.5;">t[0,0] = new Test();</span><span style="font-size:9pt;line-height:1.5;"> 로 실제 메모리를 할당하는 것 같은 기분이 들었습니다.</span></div> <div><span style="font-size:9pt;line-height:1.5;">(int, float, double 기본형 타입은 따로 new 가 필요없었습니다. 놀랍게도 string 타입도 new 할당이 필요없음. 아마 operator 나 new에서 오버로딩이 됐다고 생각합니다만..) </span></div> <div><span style="font-size:9pt;line-height:1.5;"><br></span></div> <div><span style="font-size:9pt;line-height:1.5;">(실제 어떻게 만드는지는 몰라서 참조할만한 곳이 있는지 여쭤봅니다)</span></div> <div><span style="font-size:9pt;line-height:1.5;">가물가물한데</span></div> <div>List<List<Test>> testlist; 이런식으로 했었나...했던거 같은데 결론적으로 다차원 배열에서 new 를 하지 않고 (<span style="font-size:9pt;line-height:1.5;">t[0,0] = new Test();</span><span style="font-size:9pt;line-height:1.5;"> 이런식의 new를 회피 ) </span></div> <div><span style="font-size:9pt;line-height:1.5;">아시는 사이트 중 이와 같은 사용 방법과 왜 그런지 설명이 있는 사이트 있나요?</span></div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.