static void main() { Person p1 = new Person(); p1.SetName("장현우"); p1.SetAge(33); }
static void Main() { Person p1 = new Person(); p1.name = "홍길동"; p1.SetAge(33); //p2에다가 p1의 주소값 할당 //Person p2 = p1; //p2.name = ""; Person p2 = new Person(); p2.name = p1.name; p2.age = p1.age; //새로운 객체를 생성하니 주소값이 다름 //위에 것을 함수로 단순화 한것 //Person p2 = p1.Copy(); //p1.PrintInfo(); //p2.PrintInfo(); }