알 수 없는 사용자
2014. 3. 31. 11:36
using UnityEngine;
using System.Collections;
public class Chap3 : MonoBehaviour {
// Use this for initialization
void Start () {
byte a = 250; //0~255
short b = a; //-32765 ~ 32765
ushort c = 2000; //65535
sbyte d = (sbyte)c; //-128~127
print("b =" + b);
print ("d=" + d);
}
// Update is called once per frame
void Update () {
}
}
가지고 있는 값보다 크다면 형변환을 해줘야 함. 하지만 그 값은 범위내에 있어야 제대로 표현됨.
범위내에 없다면 다른 값을 리턴