1 // 24-类型别名.cpp: 定义控制台应用程序的入口点。
2 //
3
4 #include "stdafx.h"
5 #include <iostream>
6 #include <climits>
7 #include <array>
8 #include <string>
9 using namespace std;
10
11 //类型别名类似小名,张三、李四、王五等。在Unreal引擎中经常遇到类型的别名。使用起来完全一样的。
12 //什么是宏? #define
13 #define END return 0; //当定义了宏,程序在运行前的编译阶段就已经完成了。将return 0 替换成 END。
14 #define START int main()//宏可以定义任意代码的的字符串。
15 #define FString string //后面不用加;(分号),如果写成string; 就表示将string;定义宏。
16 #define R return
17
18 //给类型起别名。
19 typedef string UString; //给string起了个别名,typedef只能给类型起别名,Ustring只能当做类型来使用。
20 //typedef最后得加;(分号)。
21
22
23
24 START
25 {
26 FString name = "uimodel"; //Fstring就等于srting。Unreal里的字符串就是FString。大量的运用了的宏。
27 cout << name << endl;
28
29 UString nickName = "uimodel";
30 cout << nickName << endl;
31
32 int t;
33 cin >> t;
34 //END
35 R 0;
36 }
37
38