value types | reference types |
int long float decimal short byte char bool struct |
class array delegate interface |
value types | int i = 5; int j = i; i = 3; (이때 메모리에는 i == 3, j == 5) |
reference types | public class Point(public int X,Y;} Point p1 = new Point(); p1.X = p1.Y = 10; Point p2 = p1; (이때 메모리에는 p1과 p2가 같은곳을 가리키고 있다...아마 X의 시작주소일테지) |
참조와 값인듯한데 값으로 할땐 그냥 하면 될꺼고
참조로 할때 X.reference 같이 아마 쓰는게 아니었나 싶은데
일단 class array delegate interface 로 참조하면 값은 아닌듯 대충 이런식?
Point p = new Point();
p.x = 10;
p.y = 10;
testFunc2(Point pt)
{
pt.x += 10;
}
'컴퓨터 과학 & 영상처리 관련 > C# / .NET / JAVA' 카테고리의 다른 글
c# overriding overriding (0) | 2012.02.03 |
---|---|
c# collections (dictionaries - the hashtable) (0) | 2012.02.03 |
c# properties (0) | 2012.02.03 |
c# access modifier (0) | 2012.02.03 |
c# char upper 사용법 (0) | 2012.02.02 |