명시적

    C++ 명시적 형변환/캐스팅 (explicit)

    명시적 형변환 int intVal = 2; float floatVal = (float)intVal; float floatVal = float(intVal); 아래와 같은 차이가 존재한다. int first = 5; int second = 2; float floatVal = first / second; float floatVal2 = (float) first / second; std::cout

    C# 사용자 정의 전환 연산자(암시적/명시적)

    using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices.ComTypes; namespace ConsoleApp8 { public struct s_data { public string name = ""; public int hp = 0, mp = 0; public s_data() { } // 데이터 대입 public s_data(string _name, int _hp, int _mp) { name = _name; hp = _hp; mp = _mp; } } // 기본 캐릭터 클래스 public class Character { public s_data data = new s_dat..