using UnityEngine;
using System.Collections;
class Person{
public Person(){birthYear = 2000;}
private int age;
public int birthYear;
public int Age{get{ return 2014 - birthYear;}}
// set{age = value;}
//}
public string Name{get; set;}
}
public class chap9_1 : MonoBehaviour {
// Use this for initialization
void Start () {
Person person1 = new Person(){
birthYear = 2014, Name = "Son"
} ;
Person[] persons = {
//new Person(2014, "Son"),
//new Person(2014, "Son"),
new Person() { birthYear = 2014, Name = "Son"} ,
new Person() { birthYear = 2010, Name = "Yoon"} ,
new Person() { birthYear = 2011, Name = "Jong"} ,
} ;
person1.birthYear = 1989;
person1.Name = "son";
print("person age = " + person1.Age + ", name = " + person1.Name);
}
// Update is called once per frame
void Update () {
}
}
'Computer Language > 유니티' 카테고리의 다른 글
이것만은 알고갚시다. 9장. (0) | 2014.05.20 |
---|---|
남은 시간 출력 하기. 그외 시간 함수 (0) | 2014.05.20 |
해쉬 테이블 DictionaryEntry 사용 예제 (0) | 2014.05.20 |
상태 이상시 잘쓰는 비트 연산 (0) | 2014.05.20 |
Item (0) | 2014.05.20 |