using UnityEngine;

using System.Collections;


class Person{

public Person(){birthYear = 2000;}

private int age;

public int birthYear;

public int Age{getreturn 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 () {

}

}



+ Recent posts