WEBVTT 1 00:00:24.120 --> 00:00:25.890 Hello, I'm Joohwan Kim 2 00:00:25.890 --> 00:00:31.360 I'll start Unreal C++ basic lecture 3: Array Pointer Reference Class 3 00:00:31.360 --> 00:00:35.919 In this lecture, we'll learn about arrays and learn to use them 4 00:00:35.919 --> 00:00:38.240 And we'll also learn about pointer reference 5 00:00:38.240 --> 00:00:41.639 And in order to do object-oriented programming on C++ class 6 00:00:41.639 --> 00:00:43.520 We're going to learn about the needed classes 7 00:00:43.520 --> 00:00:45.419 and write the actual code 8 00:00:45.770 --> 00:00:48.803 Understanding Array, Pointer, and Reference 9 00:00:50.119 --> 00:00:51.830 The word here is array 10 00:00:51.830 --> 00:00:56.279 It says it in the name, it means arranging 11 00:00:56.279 --> 00:00:59.279 We can arrange the same data types and use them 12 00:00:59.279 --> 00:01:04.320 For example, to use multiple integers using variables 13 00:01:04.320 --> 00:01:08.519 int a is 3, int B is 4, int C is 5 14 00:01:08.519 --> 00:01:11.919 We need to declare the variable every time like this 15 00:01:11.919 --> 00:01:15.680 In order to make 100 of these, we need to declare it 100 times 16 00:01:15.680 --> 00:01:19.080 Which is impossible, so we use the data structure called array 17 00:01:19.080 --> 00:01:21.480 It's the most basic data structure 18 00:01:21.480 --> 00:01:25.720 It uses the concept of pointer, which we will learn later 19 00:01:25.720 --> 00:01:29.519 Array declaration looks similar to a function 20 00:01:29.519 --> 00:01:34.559 But it's a little different, and at the very front, it indicates the type of array 21 00:01:34.559 --> 00:01:38.959 int, then MyArray which starts with capital M 22 00:01:38.959 --> 00:01:42.720 Bracket, 3, then bracket 23 00:01:42.720 --> 00:01:47.199 In C++, you always need a semicolon at the end 24 00:01:47.199 --> 00:01:53.000 What this means, is that it declares the array of integers 25 00:01:53.000 --> 00:01:54.559 It declares a 3-numbered array 26 00:01:54.559 --> 00:01:59.080 It means creating a variable called MyArray that can hold 3 integers 27 00:01:59.080 --> 00:02:07.839 For array and others, in order to understand declaration, definition, and identifier better 28 00:02:07.839 --> 00:02:11.619 As I explained before, there's MSDN of Microsoft 29 00:02:11.619 --> 00:02:15.080 You need to know the Microsoft Development Network 30 00:02:15.080 --> 00:02:18.520 I'll open the page and explain the content 31 00:02:18.520 --> 00:02:22.960 If you click the Array Declarations at the top 32 00:02:23.000 --> 00:02:27.039 As you can see, the Microsoft build MSDN page appears 33 00:02:27.039 --> 00:02:29.800 In the middle, it says Array Declaration 34 00:02:29.800 --> 00:02:32.639 Take a look at the content, syntax, examples, and references of this document 35 00:02:32.639 --> 00:02:35.160 The syntax part appears at the bottom 36 00:02:35.160 --> 00:02:38.839 This is also known as grammar 37 00:02:38.839 --> 00:02:42.919 So you can see how the syntax looks in detail 38 00:02:42.919 --> 00:02:46.160 It looks more complicated than what I explained 39 00:02:46.160 --> 00:02:51.320 But this is the most basic and complete syntax that explains array 40 00:02:51.320 --> 00:02:54.399 When you scroll to the bottom, it says example 41 00:02:54.399 --> 00:02:56.320 It literally shows examples 42 00:02:56.320 --> 00:02:59.639 It explains examples of how arrays are used 43 00:02:59.639 --> 00:03:02.839 It uses C or C++ codes as examples 44 00:03:02.839 --> 00:03:06.039 and shows how arrays are actually declared 45 00:03:06.039 --> 00:03:08.360 After the explanation, there are references 46 00:03:08.360 --> 00:03:10.039 Called reference in English 47 00:03:10.039 --> 00:03:14.320 Unlike the pointer and reference of C and C++ 48 00:03:14.320 --> 00:03:18.320 It's for looking up, so use these references to search 49 00:03:18.320 --> 00:03:20.600 It says declarer and variable declaration 50 00:03:20.600 --> 00:03:25.600 When you click the link, you can see content about declarer and variable declaration 51 00:03:25.600 --> 00:03:28.960 Array Declaration and Overboard Declarations 52 00:03:28.960 --> 00:03:35.559 are the declaration of variable arrays and the outline of declaration 53 00:03:35.559 --> 00:03:40.720 You can see the exact details through MSDN 54 00:03:40.720 --> 00:03:45.800 When declaring arrays, we use variables 55 00:03:45.800 --> 00:03:50.399 Arrays combine 100 variables into one 56 00:03:50.399 --> 00:03:52.399 So you need to learn about variables 57 00:03:52.399 --> 00:03:58.000 Lifetime is the life time of the variable, Scope is the range of the variable 58 00:03:58.000 --> 00:04:00.720 Visibility is whether we can use the variable or not 59 00:04:00.720 --> 00:04:04.720 It says it in the name 60 00:04:04.720 --> 00:04:08.080 Then there's Linkage and Summary of Lifetime Visibility 61 00:04:08.080 --> 00:04:10.180 These things can be seen in MSDN 62 00:04:10.180 --> 00:04:14.199 And you can learn about how variables work 63 00:04:14.199 --> 00:04:16.049 Back to arrays 64 00:04:16.049 --> 00:04:20.000 We can set the method of resetting the array variable 65 00:04:20.000 --> 00:04:23.550 For example, if there's integer variable A 66 00:04:23.550 --> 00:04:26.799 It will be reset to int a is 3 67 00:04:26.799 --> 00:04:30.799 But for arrays, we need to put multiple values at once 68 00:04:30.799 --> 00:04:33.079 So there's a separate way to reset 69 00:04:33.079 --> 00:04:39.379 At the very top, it says int a[5] = 70 00:04:39.379 --> 00:04:42.559 {1, 2, 3, 4, 5} 71 00:04:42.559 --> 00:04:45.309 The left part is the array variable 72 00:04:45.309 --> 00:04:48.799 The part that says int a[5] 73 00:04:48.799 --> 00:04:52.068 The equal sign is the substitution operator 74 00:04:52.069 --> 00:04:55.170 And the right part that says {1, 2, 3, 4, 5} 75 00:04:55.170 --> 00:04:58.521 show the values that will go into the array 76 00:04:58.521 --> 00:05:00.659 We created a 5-numbered array 77 00:05:00.660 --> 00:05:04.410 So we can put 1, 2, 3, 4, 5 inside, like that 78 00:05:04.410 --> 00:05:06.760 Or we can just put 1 and 2, like the second line 79 00:05:06.760 --> 00:05:08.399 and exclude other parts 80 00:05:08.399 --> 00:05:12.640 Then the excluded parts will be set as the basic value of that type 81 00:05:12.640 --> 00:05:14.920 For int, it will be 0 82 00:05:14.920 --> 00:05:19.220 Just like the third line, if in a[5] is set to 0 83 00:05:19.221 --> 00:05:21.571 Then all of them will be reset to 0 84 00:05:21.920 --> 00:05:26.439 Like the last line, if we insert array without setting the length 85 00:05:26.440 --> 00:05:28.440 It becomes a 3-numbered array 86 00:05:28.839 --> 00:05:33.760 So these are the methods of resetting the array 87 00:05:33.760 --> 00:05:37.959 Like the first one, if there's no length within the brackets after int a 88 00:05:37.959 --> 00:05:40.409 Just like the previous page 89 00:05:40.409 --> 00:05:43.279 Rather than adding 1, 2, 3 as the data 90 00:05:43.279 --> 00:05:47.089 If we just put int a = and put nothing inside the brackets 91 00:05:47.090 --> 00:05:50.390 We don't know the size, so it won't compile 92 00:05:50.390 --> 00:05:58.920 Or like the second line, if we set the int index variable to 5 93 00:05:58.920 --> 00:06:02.901 and use that variable to declare the size of the array 94 00:06:02.901 --> 00:06:05.301 it still won't compile 95 00:06:05.301 --> 00:06:06.960 It means that it's not translating 96 00:06:06.961 --> 00:06:11.161 When we compile, we need to surely know the size of the array 97 00:06:11.161 --> 00:06:13.230 So putting a changeable value 98 00:06:13.231 --> 00:06:16.781 We can put different values into Int index 5 99 00:06:16.880 --> 00:06:20.519 So if we put changeable values, it will not compile 100 00:06:20.519 --> 00:06:23.530 We call this not being the compile type constant expression 101 00:06:23.531 --> 00:06:26.781 You'll know once you learn more about C++ 102 00:06:26.880 --> 00:06:29.000 Since we reset the array value 103 00:06:29.001 --> 00:06:32.451 We need to use the value within the array 104 00:06:32.600 --> 00:06:34.839 Then we need a way to approach the array 105 00:06:34.839 --> 00:06:38.860 For arrays, the thing inside the brackets is called index 106 00:06:38.861 --> 00:06:41.261 Index means that it's pointing to something 107 00:06:41.310 --> 00:06:47.959 So it means that we're going to bring the nth element of the array 108 00:06:47.959 --> 00:06:52.570 So if you add a certain index in the brackets of MyArray 109 00:06:52.571 --> 00:06:53.871 The index starts from 0 110 00:06:53.871 --> 00:06:57.880 All programs start from 0, so index also starts from 0 111 00:06:57.880 --> 00:06:59.379 When you put 0 112 00:06:59.380 --> 00:07:01.680 The first int value will come out 113 00:07:01.680 --> 00:07:06.000 If you put 1, the second int value will be brought 114 00:07:06.000 --> 00:07:11.799 In the previous syntax, we put 1, 2, 3, 4, 5 into int a[5] 115 00:07:11.799 --> 00:07:19.040 In that case, the index of the value 1, is 0 116 00:07:19.040 --> 00:07:20.619 Because it starts from 0 117 00:07:20.620 --> 00:07:23.370 So even though we put 0, 1, 2, 3, 4 118 00:07:23.519 --> 00:07:28.200 It actually brings the first, second, third, fourth, and fifth values 119 00:07:28.200 --> 00:07:30.440 To express this with picture, it's as follows 120 00:07:30.440 --> 00:07:34.879 When we put MyArray 0, even though we put 0 121 00:07:34.879 --> 00:07:38.030 It brings the first element of that element, 3 122 00:07:38.079 --> 00:07:42.359 And if we do MyArray 1, it will bring the second element, 79 123 00:07:42.359 --> 00:07:45.630 To think about where we'll use the array 124 00:07:45.631 --> 00:07:48.831 I explained earlier about why arrays were made 125 00:07:48.880 --> 00:07:53.750 If there are 3 or 4 of the same variables 126 00:07:53.750 --> 00:07:55.351 We would declare them 3 or 4 times 127 00:07:55.600 --> 00:07:58.679 But if we need 1 million variables containing an integer 128 00:07:58.679 --> 00:08:01.480 Then we can't write 1 million of them in the code 129 00:08:01.480 --> 00:08:05.320 So we have to use the method of arrays 130 00:08:05.320 --> 00:08:08.320 So when repeating the same content 131 00:08:08.320 --> 00:08:10.180 or sorting 132 00:08:10.181 --> 00:08:13.781 Sorting certain data from the lowest to highest values 133 00:08:13.880 --> 00:08:16.160 Or from highest to lowest 134 00:08:16.160 --> 00:08:19.119 We can't create algorithm implementations for sorting 135 00:08:19.119 --> 00:08:20.959 if we don't use arrays 136 00:08:20.960 --> 00:08:24.010 Since we can't handle the same data types in a linear form 137 00:08:24.010 --> 00:08:25.399 we can't implement sorting 138 00:08:25.399 --> 00:08:28.480 Also, without arrays, everything that handles data dynamically, is impossible 139 00:08:28.480 --> 00:08:30.419 Such as inventory implementation 140 00:08:30.420 --> 00:08:33.720 We can't create data sets that change in real-time 141 00:08:33.970 --> 00:08:36.620 After arrays, I'll now explain the pointer 142 00:08:36.620 --> 00:08:40.219 For pointer, when learning C and C++ language 143 00:08:40.220 --> 00:08:43.620 It's a difficult concept that they call the biggest obstacle 144 00:08:43.719 --> 00:08:46.640 I'll try to explain it as easy as possible 145 00:08:46.640 --> 00:08:51.400 Pointer, just like the name says, it points to something 146 00:08:51.400 --> 00:08:57.039 And the way to express what it's pointing to, is the address 147 00:08:57.039 --> 00:08:59.610 Whether it's variable, object, or function 148 00:08:59.611 --> 00:09:02.011 It can point to a target 149 00:09:02.011 --> 00:09:04.349 For the method of pointing 150 00:09:04.350 --> 00:09:07.600 it brings the address of where the object exists within the memory 151 00:09:07.600 --> 00:09:09.599 Inside the computer, there's the memory 152 00:09:09.599 --> 00:09:11.719 And the values go inside the memory 153 00:09:11.719 --> 00:09:15.359 Where that value is located, is the address 154 00:09:15.359 --> 00:09:19.400 The address is usually in x86 environment 155 00:09:19.400 --> 00:09:20.850 What x86 is, is that 156 00:09:20.850 --> 00:09:25.320 32 bit computer lines are usually called x86 157 00:09:25.320 --> 00:09:30.200 In the past, when computer environments were in 286, 386, and 486 158 00:09:30.200 --> 00:09:35.200 The address value of the pointer, or the address size of the memory was 4 bytes 159 00:09:35.200 --> 00:09:40.080 Since 1 byte is 8 bit and 4 bytes is 32 bit 160 00:09:40.080 --> 00:09:43.840 Then the size of the memory that can be pointed with point variable 4 byte 161 00:09:43.841 --> 00:09:45.841 is about 4 GB 162 00:09:45.841 --> 00:09:48.060 So in x86 environment computers 163 00:09:48.061 --> 00:09:49.760 Most of the point variables are 4 bytes 164 00:09:49.760 --> 00:09:51.460 I say "most" because 165 00:09:51.461 --> 00:09:53.861 Almost all point variables are 4 bytes 166 00:09:53.861 --> 00:09:56.330 because the memory address is the size of 4 bytes 167 00:09:56.331 --> 00:09:58.831 but there may be exceptions 168 00:09:58.880 --> 00:10:03.799 And the pointing target can be variables, objects, or functions 169 00:10:03.799 --> 00:10:08.640 For details about pointer declaration, take a look at MSDN 170 00:10:08.640 --> 00:10:10.960 Let's click on it and take a look together 171 00:10:10.960 --> 00:10:13.359 Click Pointer Declarations 172 00:10:13.359 --> 00:10:14.880 Now it says it in English 173 00:10:14.880 --> 00:10:18.289 In the Learn C++, C and Assembler option 174 00:10:18.290 --> 00:10:21.090 It says Pointer Declarations 175 00:10:21.090 --> 00:10:27.760 Here, there are syntax, example, and see also 176 00:10:27.760 --> 00:10:29.479 In the beginning, there's an abstract description 177 00:10:29.479 --> 00:10:32.239 It says that a pointer declaration names a pointer variable 178 00:10:32.239 --> 00:10:35.430 Just like how I briefly explained earlier 179 00:10:35.431 --> 00:10:37.081 It has the same explanations 180 00:10:37.081 --> 00:10:40.119 It says it in English, but if you want to read it in Korean 181 00:10:40.239 --> 00:10:45.400 you can click the Korean icon at the top right hand corner and change it to Korean 182 00:10:45.400 --> 00:10:48.359 Syntax means the grammar 183 00:10:48.359 --> 00:10:52.520 And after the pointer variable, asterisk is used 184 00:10:52.520 --> 00:10:56.320 to set the pointer variable, is what it says 185 00:10:56.320 --> 00:10:58.359 Same thing for examples 186 00:10:58.359 --> 00:11:00.810 It shows examples of using pointer variables 187 00:11:00.811 --> 00:11:02.661 It explains in detail 188 00:11:02.960 --> 00:11:06.159 C and C++ are almost the same 189 00:11:06.159 --> 00:11:09.439 In C language, the char pointer form and int pointer form 190 00:11:09.440 --> 00:11:11.890 are exampled in the syntax all the way to the bottom 191 00:11:12.039 --> 00:11:15.840 In See also, it says Declarators and Variable Declarations 192 00:11:15.840 --> 00:11:20.000 You also need to know about declarations and the declaration of variables 193 00:11:20.000 --> 00:11:22.880 Pointer, when learning the C and C++ language 194 00:11:22.880 --> 00:11:26.679 is a very difficult concept for beginners 195 00:11:26.679 --> 00:11:29.440 There's a reason why they made this pointer so difficult 196 00:11:29.440 --> 00:11:32.400 To put pointer in simple terms 197 00:11:32.400 --> 00:11:35.440 it's just a variable that points to an address 198 00:11:35.440 --> 00:11:39.719 But it becomes difficult for beginners because 199 00:11:39.719 --> 00:11:44.559 there are two main operators for using pointers 200 00:11:44.559 --> 00:11:47.840 The star operator, which is the indirect reference operator 201 00:11:47.840 --> 00:11:50.239 That star is called asterisk 202 00:11:50.239 --> 00:11:53.159 There's the asterisk operator, and there's the address operator 203 00:11:53.159 --> 00:11:55.200 &, and it's called ampersand 204 00:11:55.200 --> 00:11:56.999 Those two operators 205 00:11:57.000 --> 00:12:00.600 are used as different meanings, so that's why it's difficult 206 00:12:00.600 --> 00:12:03.159 It may cause confusions 207 00:12:03.159 --> 00:12:04.840 That's how C grammar is like 208 00:12:04.840 --> 00:12:06.840 To tell you the basic form 209 00:12:06.840 --> 00:12:09.000 the asterisk, which is the indirect reference operator 210 00:12:09.000 --> 00:12:10.960 When there's a point variable 211 00:12:10.960 --> 00:12:13.640 and you put that operator in the front 212 00:12:13.640 --> 00:12:15.960 Then it brings that value from that address 213 00:12:15.960 --> 00:12:18.080 The address operator, ampersand, on the other hand 214 00:12:18.080 --> 00:12:20.919 When you put ampersand in front of a variable 215 00:12:20.919 --> 00:12:22.760 Then it brings the address of the variable 216 00:12:22.760 --> 00:12:25.520 It's simple if you look at it this way 217 00:12:25.520 --> 00:12:26.640 But it's actually not 218 00:12:26.640 --> 00:12:28.880 Because when you look at the text 219 00:12:28.880 --> 00:12:32.479 For the first one, it says int a is 0 220 00:12:32.479 --> 00:12:36.760 It declares a very simple variable 221 00:12:36.760 --> 00:12:38.760 and defines it as 0 222 00:12:38.760 --> 00:12:42.080 It declares an integer variable, a 223 00:12:42.080 --> 00:12:45.840 and substitutes it for an integer called 0, using the equal sign 224 00:12:45.840 --> 00:12:49.440 The second syntax is the typical usage of point variable 225 00:12:49.440 --> 00:12:52.080 It's called int* pA 226 00:12:52.080 --> 00:12:54.679 When that asterisk is used as punctuation point 227 00:12:54.679 --> 00:12:56.080 it called asterisk 228 00:12:56.080 --> 00:12:58.000 But when we read it, we say point 229 00:12:58.000 --> 00:13:00.719 int pointer type 230 00:13:00.719 --> 00:13:02.840 So the first line is int type a 231 00:13:02.840 --> 00:13:07.520 And the second line is the int pointer type pA 232 00:13:07.520 --> 00:13:09.200 What that part means, is that 233 00:13:09.201 --> 00:13:12.101 Where integer is included 234 00:13:12.101 --> 00:13:14.840 Variable a, where integer is included 235 00:13:14.840 --> 00:13:18.320 That's where this variable can point to 236 00:13:18.320 --> 00:13:22.280 It means that it's a variable that can hold the address that can point to a variable 237 00:13:22.280 --> 00:13:25.640 In int point pA, where address is held 238 00:13:25.640 --> 00:13:29.840 In the variable pA, when we add ampersand 239 00:13:29.840 --> 00:13:33.280 We said earlier that the ampersand, the address operator, brings the memory address 240 00:13:33.280 --> 00:13:38.479 When we do &a for the variable of pA 241 00:13:38.479 --> 00:13:43.700 Then it brings the address of variable a of the top line, int a = 0 242 00:13:43.700 --> 00:13:48.280 So in pA, a won't be substituted for 0 243 00:13:48.280 --> 00:13:50.329 For the variable a 244 00:13:50.330 --> 00:13:53.430 pA will bring in the value of the location within the memory 245 00:13:53.679 --> 00:13:56.559 When it reads hexadecimal 246 00:13:56.559 --> 00:13:59.359 It will be something like 0xffff332 247 00:13:59.359 --> 00:14:02.769 The very long value that expresses the memory address 248 00:14:02.770 --> 00:14:04.070 will be inserted into pA 249 00:14:04.119 --> 00:14:06.940 Then for variable pA 250 00:14:06.941 --> 00:14:10.291 the address of the variable a will come out 251 00:14:10.291 --> 00:14:12.760 Then we can bring in the value through that address 252 00:14:12.760 --> 00:14:14.559 The third line is an example of that 253 00:14:14.559 --> 00:14:18.679 int b brings in the value of pA 254 00:14:18.679 --> 00:14:21.520 That syntax isn't called pointer 255 00:14:21.520 --> 00:14:22.960 It's now called the asterisk operator 256 00:14:22.960 --> 00:14:25.119 It's the dereference of pA 257 00:14:25.119 --> 00:14:27.399 Go to the address of pA 258 00:14:27.400 --> 00:14:29.800 and bring in the value and insert it to b 259 00:14:29.800 --> 00:14:33.239 As a result, in the variable of int b 260 00:14:33.239 --> 00:14:36.280 The value of int a, 0, will be inserted 261 00:14:36.280 --> 00:14:37.610 For putting in values 262 00:14:37.611 --> 00:14:41.711 you may wonder why we use such a complicated process 263 00:14:41.811 --> 00:14:45.159 But in order to do object-orientation later on 264 00:14:45.159 --> 00:14:49.679 pointer is a very basic grammar for pointing to something 265 00:14:49.679 --> 00:14:51.280 So even though it's difficult 266 00:14:51.280 --> 00:14:53.440 This is as much as you should know 267 00:14:54.440 --> 00:14:57.400 And further on, when you do Unreal C++ Programming 268 00:14:57.400 --> 00:15:00.679 it will become an important element, so be sure to learn them 269 00:15:00.679 --> 00:15:02.440 After reasons why pointers are so difficult 270 00:15:02.440 --> 00:15:06.880 I also put C++ reference at the end 271 00:15:06.880 --> 00:15:10.000 Later, another grammar is added in C++ 272 00:15:10.000 --> 00:15:13.880 So just like the int pointer pA of the second line 273 00:15:13.880 --> 00:15:17.320 int reference a will be added 274 00:15:17.320 --> 00:15:22.359 Unlike the ampersand operator of the second line 275 00:15:22.359 --> 00:15:26.000 This is a different operator from the operator that brings the address 276 00:15:26.000 --> 00:15:28.200 To be exact, it's not an operator but a punctuation point 277 00:15:28.200 --> 00:15:29.679 Just like the int pointer type 278 00:15:29.679 --> 00:15:31.840 There's something called int reference type 279 00:15:31.840 --> 00:15:37.440 So if you take a look, there's the indirect reference operator asterisk 280 00:15:37.440 --> 00:15:39.559 The indirect reference operator in the third line 281 00:15:39.559 --> 00:15:42.960 which brings the value from the memory 282 00:15:42.960 --> 00:15:48.239 And the asterisk punctuation point that corresponds to int pointer type 283 00:15:48.239 --> 00:15:50.799 Uses the same star symbol 284 00:15:50.799 --> 00:15:52.980 But the stars in the second line and the third line 285 00:15:52.981 --> 00:15:54.181 have two completely different meanings 286 00:15:54.280 --> 00:15:57.280 And the &a of the second line 287 00:15:57.280 --> 00:16:02.679 and the & a in the fourth line, int reference, are also completely different 288 00:16:02.679 --> 00:16:07.200 This is what makes pointers so difficult in C and C++ 289 00:16:07.200 --> 00:16:09.320 It's a huge obstacle for beginners 290 00:16:09.320 --> 00:16:11.679 If you think it's too complicated 291 00:16:11.679 --> 00:16:15.520 The indirect reference operator asterisk that I explained first 292 00:16:15.520 --> 00:16:19.760 and the address operator &, are what you should take a look at first 293 00:16:19.760 --> 00:16:22.679 At the end, once you just learn how to use the second one 294 00:16:22.679 --> 00:16:25.039 you will be able to explain the basic pointer 295 00:16:25.039 --> 00:16:29.440 There's the reference grammar that I mentioned as the fourth one 296 00:16:29.440 --> 00:16:32.840 This reference works similar to pointers 297 00:16:32.840 --> 00:16:34.719 It's a newly added grammar 298 00:16:34.719 --> 00:16:38.080 There's a simple syntax called int a = 3 299 00:16:38.080 --> 00:16:39.719 Inside the a, there's 3 300 00:16:39.719 --> 00:16:42.719 If we say that int reference rA is a 301 00:16:42.719 --> 00:16:45.159 Then when the variable of a exists 302 00:16:45.159 --> 00:16:49.719 The variable of a and rA are connected by reference 303 00:16:49.919 --> 00:16:52.280 Before, when we used pointer 304 00:16:52.530 --> 00:16:56.719 the int pointer type, ampersand address reference operator 305 00:16:56.719 --> 00:17:00.799 int b, and asterisk dereference operator were used 306 00:17:00.799 --> 00:17:03.320 But without the need of all these parts 307 00:17:03.320 --> 00:17:06.560 When we only just reference in C++ 308 00:17:06.560 --> 00:17:10.119 rA and a are treated the same way 309 00:17:10.119 --> 00:17:12.959 When the value of rA is changed, a value also changes 310 00:17:12.959 --> 00:17:15.079 Then a value is changed, rA value will be changed 311 00:17:15.079 --> 00:17:18.000 It's basically a form of nickname 312 00:17:18.000 --> 00:17:19.920 Many grammars were skipped 313 00:17:19.920 --> 00:17:21.680 so when reference is used 314 00:17:21.680 --> 00:17:25.719 we can use references more easier than pointers 315 00:17:25.719 --> 00:17:28.239 In pointer, there's also multiple grammars 316 00:17:28.239 --> 00:17:30.479 I'll first explain about the double pointer 317 00:17:30.479 --> 00:17:34.520 I said that pointer points to the address of a variable 318 00:17:34.520 --> 00:17:37.040 That's the first syntax that you can see 319 00:17:37.040 --> 00:17:38.000 To explain again 320 00:17:38.000 --> 00:17:42.680 It creates variable pA of the int pointer type 321 00:17:42.680 --> 00:17:44.880 It can hold the address 322 00:17:44.880 --> 00:17:47.359 So at the top, there will be variable a 323 00:17:47.359 --> 00:17:49.640 It brings the address of variable a 324 00:17:49.640 --> 00:17:53.160 and will hold it in pA 325 00:17:53.160 --> 00:17:56.640 The second one, int double point ppA 326 00:17:57.040 --> 00:17:59.119 The pointer variable pA 327 00:17:59.119 --> 00:18:02.079 so the variable that can hold the address 328 00:18:02.079 --> 00:18:04.880 It will bring the address of that variable 329 00:18:04.880 --> 00:18:07.040 As I explained earlier, the pointer of a pointer 330 00:18:07.040 --> 00:18:08.359 and the pointer of that pointer 331 00:18:08.359 --> 00:18:10.520 That's how we can implement multiple pointers 332 00:18:10.520 --> 00:18:12.839 More than 3 pointers are usually not used 333 00:18:12.839 --> 00:18:16.119 That's because address reference 334 00:18:16.119 --> 00:18:18.319 rarely requires multiple steps 335 00:18:18.319 --> 00:18:21.760 Also, it won't be intuitive for people 336 00:18:21.760 --> 00:18:23.680 So if we must use them 337 00:18:23.680 --> 00:18:26.640 Pointer or double pointer types will be replaced 338 00:18:26.640 --> 00:18:27.880 As you will learn earlier 339 00:18:27.880 --> 00:18:30.960 Nicknames will be made for the types 340 00:18:30.960 --> 00:18:33.079 And those will be used as pointers 341 00:18:33.079 --> 00:18:36.000 When explaining pointers 342 00:18:36.000 --> 00:18:38.680 I can't forget this part 343 00:18:38.800 --> 00:18:41.520 The structure, although we haven't learn about it yet 344 00:18:41.520 --> 00:18:44.520 When we learn class 345 00:18:44.520 --> 00:18:46.599 Class and structure are basically the same thing 346 00:18:46.599 --> 00:18:50.439 There are times when we need to use the pointer of class and structure 347 00:18:50.439 --> 00:18:52.520 So class and structure 348 00:18:52.520 --> 00:18:55.599 When they exist as variables in the pointer forms 349 00:18:55.599 --> 00:18:58.119 Then we use the arrow operator 350 00:18:58.119 --> 00:18:59.920 And rather than structure pointer 351 00:18:59.920 --> 00:19:01.880 if it's just the structure object 352 00:19:01.880 --> 00:19:03.880 then we use a period 353 00:19:03.880 --> 00:19:06.359 I'll show you the examples later 354 00:19:07.010 --> 00:19:09.368 Understanding Class 355 00:19:11.130 --> 00:19:13.479 Then earlier, we mentioned class and structure 356 00:19:13.479 --> 00:19:15.040 Those are objects 357 00:19:15.040 --> 00:19:17.719 I'll now explain about object-oriented programming 358 00:19:17.719 --> 00:19:20.119 It's also called OOP 359 00:19:20.119 --> 00:19:22.920 Object Oriented Programming 360 00:19:22.920 --> 00:19:27.520 It's a concept used in C++ and C# 361 00:19:27.520 --> 00:19:29.959 In C++, C#, or Java 362 00:19:29.959 --> 00:19:32.000 before the emergence of OOP 363 00:19:32.000 --> 00:19:35.319 the data and the way of data operation, were divided 364 00:19:35.319 --> 00:19:36.719 To put it in simple terms 365 00:19:36.719 --> 00:19:39.040 In the variable int a 366 00:19:39.040 --> 00:19:41.680 3 goes in as the data 367 00:19:41.680 --> 00:19:45.319 And take that 3 and the 2 from b 368 00:19:45.319 --> 00:19:48.119 And create a function that adds the two variables 369 00:19:48.119 --> 00:19:50.800 Like this, the part where the data was inserted 370 00:19:50.800 --> 00:19:53.359 and the part where the data operated, were divided separately 371 00:19:53.359 --> 00:19:55.560 But with the emergence of object-oriented programming 372 00:19:55.560 --> 00:19:57.680 They created something called object 373 00:19:57.680 --> 00:20:00.680 The object of the object-orientation is 374 00:20:00.680 --> 00:20:03.599 something that combined the data 375 00:20:03.599 --> 00:20:05.479 and the method of how the data operates 376 00:20:05.479 --> 00:20:09.359 For the method of combining, class came to play 377 00:20:09.359 --> 00:20:11.800 Class is the structure of C 378 00:20:11.800 --> 00:20:16.119 It's a form developed from combining multiple variables 379 00:20:16.119 --> 00:20:18.280 The initial name was called C with Classes 380 00:20:18.280 --> 00:20:20.400 It becomes C++ later on 381 00:20:20.400 --> 00:20:24.880 In 1978, Bjarne Stroustrup created 382 00:20:24.880 --> 00:20:27.640 C++, and that becomes the language 383 00:20:27.640 --> 00:20:30.400 As it was called C with Classes at first 384 00:20:30.400 --> 00:20:33.160 Class didn't exist in C at first 385 00:20:33.160 --> 00:20:35.079 In the structure form 386 00:20:35.079 --> 00:20:37.760 And it appeared in C++ 387 00:20:37.760 --> 00:20:40.199 That class is the core element 388 00:20:40.199 --> 00:20:43.000 of object-orientation that made C++ 389 00:20:43.000 --> 00:20:46.959 As I explained earlier, class, unlike structure 390 00:20:46.959 --> 00:20:49.680 links data and function 391 00:20:49.680 --> 00:20:52.359 And I can make it myself 392 00:20:52.359 --> 00:20:56.040 For example, unlike int that hold integers, float that holds real numbers 393 00:20:56.040 --> 00:20:58.160 and string that holds letters 394 00:20:58.160 --> 00:21:01.560 The player holds people 395 00:21:01.560 --> 00:21:04.359 Monster holds the enemy 396 00:21:04.359 --> 00:21:08.119 Or tools, inventory 397 00:21:08.269 --> 00:21:12.239 Like these, the data and the various operations of the data are linked 398 00:21:12.239 --> 00:21:15.599 into one class 399 00:21:15.599 --> 00:21:17.359 All these are linked at once 400 00:21:17.359 --> 00:21:20.119 and can be considered as one through class 401 00:21:20.119 --> 00:21:21.160 And this is how it looks 402 00:21:21.160 --> 00:21:23.839 If you take a look, there's a 3-line annotation 403 00:21:23.839 --> 00:21:27.280 When we use two or three slashes, it called annotation 404 00:21:27.280 --> 00:21:30.520 Unlike grammar, it doesn't get compiled 405 00:21:30.520 --> 00:21:32.280 It's the part that holds explanations 406 00:21:32.280 --> 00:21:34.439 It says class declaration 407 00:21:34.439 --> 00:21:37.719 and it says class CPlayer 408 00:21:37.719 --> 00:21:40.400 class CPlayer 409 00:21:40.400 --> 00:21:43.239 operates like int 410 00:21:43.239 --> 00:21:45.760 And the part that corresponds to int is CPlayer 411 00:21:45.760 --> 00:21:48.199 We put the keyword 'class' at the front 412 00:21:48.199 --> 00:21:50.719 And after that, put CPlayer 413 00:21:50.719 --> 00:21:53.319 or the type that I want to make 414 00:21:53.319 --> 00:21:56.920 Again, this doesn't correspond to the a of int a = 3 415 00:21:56.920 --> 00:21:58.280 It corresponds to int 416 00:21:58.280 --> 00:22:01.839 It's like a blueprint that makes the type 417 00:22:01.839 --> 00:22:05.640 Put class CPlayer, then open braces 418 00:22:05.640 --> 00:22:11.239 Inside that, put the variables and functions that I want to insert into the class 419 00:22:11.239 --> 00:22:14.319 Then we can link this as one and create an object 420 00:22:14.319 --> 00:22:15.839 I'll now explain the code 421 00:22:15.839 --> 00:22:19.160 It says Private int m_HP 422 00:22:19.160 --> 00:22:21.920 The variable m_HP 423 00:22:21.920 --> 00:22:24.719 is in the integer form 424 00:22:24.719 --> 00:22:29.199 It's a variable called HP that can hold values in integer forms 425 00:22:29.199 --> 00:22:32.520 Usually, prefix m_ is used 426 00:22:32.520 --> 00:22:35.400 This is the prefix that indicates 427 00:22:35.400 --> 00:22:38.640 that it's a variable inside a class 428 00:22:38.640 --> 00:22:40.640 It means member 429 00:22:40.640 --> 00:22:42.319 And since it says HP 430 00:22:42.319 --> 00:22:45.880 It means Hit Point or Health Point 431 00:22:45.880 --> 00:22:49.640 So it's a variable created for indicating the health of the player 432 00:22:49.640 --> 00:22:53.119 After that, it says Private then a colon 433 00:22:53.119 --> 00:22:57.079 Private colon means access modifier 434 00:22:57.079 --> 00:23:00.959 Whether it can be used inside the class 435 00:23:00.959 --> 00:23:04.199 In other words, whether it can be used only within the CPlayer class 436 00:23:04.199 --> 00:23:07.199 Or whether we can make CPlayer outside 437 00:23:07.199 --> 00:23:11.130 and approach the CPlayer from the outside, is what it means 438 00:23:11.130 --> 00:23:13.880 For Private int m_HP 439 00:23:13.880 --> 00:23:16.920 It's the health within the player class 440 00:23:16.920 --> 00:23:19.479 I'll be the only one using my health 441 00:23:19.479 --> 00:23:21.439 It means that only I'll know about it and use it 442 00:23:21.439 --> 00:23:24.680 Under that, for Protected int m_Weapon 443 00:23:24.680 --> 00:23:29.000 It's the index of the weapon 444 00:23:29.000 --> 00:23:33.280 The integer value, at the protected state 445 00:23:33.280 --> 00:23:35.719 We'll learn about the meaning through inheritance later 446 00:23:35.719 --> 00:23:40.400 But when we inherit the class, I'll only use it in mine and my daughter's class 447 00:23:40.400 --> 00:23:43.359 Under that, Public is 448 00:23:43.359 --> 00:23:46.520 being able to use from the outside 449 00:23:46.520 --> 00:23:48.340 It accessible from anywhere 450 00:23:48.341 --> 00:23:50.391 It means Public, as the name says 451 00:23:50.640 --> 00:23:53.400 Under Public, it says Void Move 452 00:23:53.400 --> 00:23:55.239 (float dTime) 453 00:23:55.239 --> 00:23:57.920 As you've seen a lot, this is a function 454 00:23:57.920 --> 00:24:00.199 The return type is in void 455 00:24:00.199 --> 00:24:01.920 What void is 456 00:24:01.920 --> 00:24:05.680 It means that there's no return type 457 00:24:05.680 --> 00:24:07.599 It's a function that doesn't return 458 00:24:07.599 --> 00:24:12.880 It receives float, a real number form, called variable dTime 459 00:24:12.880 --> 00:24:15.920 and moves, is what this function means 460 00:24:15.920 --> 00:24:17.800 We call it member function 461 00:24:17.800 --> 00:24:19.719 To explain the code briefly 462 00:24:19.719 --> 00:24:22.560 dTime in float form is delta time 463 00:24:22.560 --> 00:24:26.400 So this character, within a certain time frame 464 00:24:26.400 --> 00:24:30.199 Delta usually means displacement 465 00:24:30.199 --> 00:24:32.640 In terms of time, it means variable 466 00:24:32.640 --> 00:24:35.439 Move per time unit 467 00:24:35.439 --> 00:24:38.400 is the meaning that it's trying to have 468 00:24:38.400 --> 00:24:41.280 It's the declaration of the function 469 00:24:41.280 --> 00:24:45.239 For the SetPlayer function on the bottom, it even includes the text 470 00:24:45.239 --> 00:24:46.599 Within the class 471 00:24:46.599 --> 00:24:48.599 on top of function declaration 472 00:24:48.599 --> 00:24:50.079 we can even write the text 473 00:24:50.079 --> 00:24:53.239 SetPlayer m_HP is 0 474 00:24:53.239 --> 00:24:55.359 The function Set Player 475 00:24:55.359 --> 00:25:00.160 is the function that makes HealthPoint HP to 0 476 00:25:00.160 --> 00:25:02.119 Class looks like this overall 477 00:25:02.119 --> 00:25:04.880 The class form that I just explained 478 00:25:04.880 --> 00:25:07.719 corresponds to the declaration of class 479 00:25:07.719 --> 00:25:11.000 I explained about declaration and definition earlier 480 00:25:11.000 --> 00:25:13.760 Declaration means I'm going to use this 481 00:25:13.760 --> 00:25:16.520 It literally means declaring 482 00:25:16.520 --> 00:25:18.239 That I'm going to use it 483 00:25:18.239 --> 00:25:20.920 But for definition, the content 484 00:25:20.920 --> 00:25:22.040 is what it defines 485 00:25:22.040 --> 00:25:23.920 The value of M_HP 486 00:25:23.920 --> 00:25:27.239 the value of weapon, and the text of move function 487 00:25:27.239 --> 00:25:28.520 are not written in this declaration 488 00:25:28.520 --> 00:25:32.239 Of course, the SetPlayer function has the text as well 489 00:25:32.239 --> 00:25:34.479 But the move function doesn't have text 490 00:25:34.479 --> 00:25:36.560 That's why this part is class declaration 491 00:25:36.560 --> 00:25:39.839 Just like arrays, if we think about why we use this 492 00:25:39.839 --> 00:25:42.400 Class means the data 493 00:25:42.400 --> 00:25:44.520 and the way of how the data operates 494 00:25:44.520 --> 00:25:46.239 combined together 495 00:25:46.239 --> 00:25:49.239 From here, OOP emerged 496 00:25:49.239 --> 00:25:51.319 So when first learning about class 497 00:25:51.319 --> 00:25:53.959 When learning about class using C++ 498 00:25:53.959 --> 00:25:56.479 Any objects can be described with class 499 00:25:56.479 --> 00:26:00.520 For example, person, wheels of a bus 500 00:26:00.520 --> 00:26:03.040 handle, frame, window 501 00:26:03.040 --> 00:26:05.560 Linking these together to make a bus 502 00:26:05.560 --> 00:26:08.400 For all objects, depicting them with class 503 00:26:08.400 --> 00:26:11.800 will be tried when first learning about class 504 00:26:11.800 --> 00:26:14.400 I explained earlier in the class structure 505 00:26:14.400 --> 00:26:16.760 But to go back to it 506 00:26:16.760 --> 00:26:20.560 In the middle, the void Move float dTime 507 00:26:20.560 --> 00:26:22.719 and void SetPlayer 508 00:26:22.719 --> 00:26:24.119 are called member functions 509 00:26:24.119 --> 00:26:26.920 You may wonder why we call it member function 510 00:26:26.920 --> 00:26:30.319 It's because it's a function that belongs to a class 511 00:26:30.319 --> 00:26:32.239 Same thing for M_HP 512 00:26:32.239 --> 00:26:34.199 and M_weapon 513 00:26:34.199 --> 00:26:36.000 They're also called member variables 514 00:26:36.000 --> 00:26:38.599 To explain member function first 515 00:26:38.599 --> 00:26:42.160 Before, the function that had no association with data 516 00:26:42.160 --> 00:26:45.800 are now linked in the name of class CPlayer 517 00:26:45.800 --> 00:26:48.760 So this member function only operates 518 00:26:48.760 --> 00:26:51.160 on the player, is what it means 519 00:26:51.160 --> 00:26:54.079 In other words, the data and operation 520 00:26:54.079 --> 00:26:58.079 The data and operation have cohesiveness 521 00:26:58.079 --> 00:27:00.199 It means they're related 522 00:27:00.199 --> 00:27:02.160 That's one 523 00:27:02.160 --> 00:27:04.040 And a function that we get by using member function 524 00:27:04.040 --> 00:27:05.800 is called data concealment 525 00:27:05.800 --> 00:27:07.719 We can hide the data 526 00:27:07.719 --> 00:27:10.920 As for the class that we talked about earlier 527 00:27:10.920 --> 00:27:13.160 The int form called m_hp 528 00:27:13.160 --> 00:27:17.400 The integer variable that represents health 529 00:27:17.400 --> 00:27:19.199 is declared privately 530 00:27:19.199 --> 00:27:22.040 so it's unapproachable from the outside the class 531 00:27:22.040 --> 00:27:25.560 But if the function called SetPlayer 532 00:27:25.560 --> 00:27:29.680 is called Public, then we can reset it 533 00:27:29.680 --> 00:27:30.800 That's what it means 534 00:27:30.800 --> 00:27:34.040 This is called data concealment 535 00:27:34.040 --> 00:27:36.479 Also known as data hiding 536 00:27:36.479 --> 00:27:39.560 capsule, or incapsulation 537 00:27:39.560 --> 00:27:42.119 And in the class, in the member function 538 00:27:42.119 --> 00:27:44.119 Operator overloading 539 00:27:44.119 --> 00:27:46.359 such as adding or subtracting 540 00:27:46.359 --> 00:27:49.959 The existing operators can be re-defined 541 00:27:49.959 --> 00:27:53.160 We can re-define them as member functions 542 00:27:53.160 --> 00:27:56.439 For example, it may not make sense in reality but 543 00:27:56.439 --> 00:27:59.319 Adding two players together 544 00:27:59.319 --> 00:28:02.439 Or multiplying players, are possible 545 00:28:02.439 --> 00:28:05.520 It's like defining the operators in math 546 00:28:05.520 --> 00:28:07.760 Now this is the capsulation or concealment that I talked about earlier 547 00:28:07.760 --> 00:28:10.800 It's called incapsulation or data hiding 548 00:28:10.800 --> 00:28:15.239 As mentioned earlier, HP or health is set as private 549 00:28:15.239 --> 00:28:19.800 Hide it, then only use it for public function 550 00:28:19.800 --> 00:28:21.920 That's incapsulation or data hiding 551 00:28:21.920 --> 00:28:23.719 They're two similar words 552 00:28:23.719 --> 00:28:26.439 They basically mean the same things 553 00:28:26.439 --> 00:28:30.479 Capsulation, like surrounding it with a capsule so that it can't be seen 554 00:28:30.479 --> 00:28:32.800 Hiding, literally means hiding the data 555 00:28:32.800 --> 00:28:37.079 As mentioned earlier, private, protected, or public 556 00:28:37.079 --> 00:28:39.560 are the access specifiers that we can use for capsulation 557 00:28:39.560 --> 00:28:40.719 Whether we can approach from the outside 558 00:28:40.719 --> 00:28:43.359 or only from the inside, can be distinguished 559 00:28:43.359 --> 00:28:46.640 And through these, we can link the unit of implementation 560 00:28:46.640 --> 00:28:48.319 And this is called wrapping 561 00:28:48.319 --> 00:28:50.079 Literally means wrapping around 562 00:28:50.079 --> 00:28:55.119 In class, there are basic functions 563 00:28:55.119 --> 00:28:58.439 Among them, I'll explain the constructor 564 00:28:58.439 --> 00:29:01.000 It's called constructor in English 565 00:29:01.000 --> 00:29:05.160 For the CPlayer class that we saw earlier 566 00:29:05.160 --> 00:29:08.400 Another function with the same name as the class, is made 567 00:29:08.400 --> 00:29:09.959 Or it can be made 568 00:29:09.959 --> 00:29:12.400 It uses the same name of CPlayer 569 00:29:12.400 --> 00:29:17.079 and if it's in the form of function, then a special function called constructor is created 570 00:29:17.079 --> 00:29:22.400 The top part is the syntax that declares the constructor and the destructor 571 00:29:22.400 --> 00:29:24.040 So there's no text 572 00:29:24.040 --> 00:29:27.839 On the bottom, the constructor of CPlayer 573 00:29:27.839 --> 00:29:30.640 and the destructor of CPlayer are declared 574 00:29:30.640 --> 00:29:32.479 So there are braces and content 575 00:29:32.479 --> 00:29:36.359 Of course, there's nothing inside the braces, so it won't do anything 576 00:29:36.359 --> 00:29:38.040 But there's still content 577 00:29:38.040 --> 00:29:42.119 So constructor of class 578 00:29:42.119 --> 00:29:45.079 When creating a specific class 579 00:29:45.079 --> 00:29:49.599 When creating the CPlayer class, constructor is the function that's automatically called 580 00:29:49.599 --> 00:29:51.280 It's called over automatically 581 00:29:51.280 --> 00:29:53.160 As you've seen the member functions earlier 582 00:29:53.160 --> 00:29:56.920 like m_HP or m_Weapon 583 00:29:56.920 --> 00:30:01.599 It's used for resetting the members inside 584 00:30:01.719 --> 00:30:04.160 The special part is that there's no return value 585 00:30:04.160 --> 00:30:06.319 It means that it doesn't return any value 586 00:30:06.319 --> 00:30:08.920 Its role is to reset while constructing 587 00:30:08.920 --> 00:30:11.439 so it doesn't need to make any values 588 00:30:11.439 --> 00:30:12.959 I've said that overloading is possible 589 00:30:12.959 --> 00:30:15.079 For overloading, it means that 590 00:30:15.079 --> 00:30:19.160 functions with the same name and different roles can be made 591 00:30:19.160 --> 00:30:21.079 Default provided means that 592 00:30:21.079 --> 00:30:24.479 the compiler that compiles the program 593 00:30:24.479 --> 00:30:28.319 basically creates the constructor, and that can be used 594 00:30:28.319 --> 00:30:29.959 There's a similar concept called destructor 595 00:30:29.959 --> 00:30:37.599 CPlayer { } refers to the constructor 596 00:30:37.599 --> 00:30:41.160 and under that, the thing with the ~ sign in the front is the destructor 597 00:30:41.160 --> 00:30:43.560 It's called destructor in English 598 00:30:43.560 --> 00:30:47.239 Before, we also called it the destroyer but now we say destructor more 599 00:30:47.239 --> 00:30:49.959 For the destructor 600 00:30:49.959 --> 00:30:52.400 when a specific object is destructing 601 00:30:52.400 --> 00:30:54.319 it gets called over 602 00:30:54.319 --> 00:30:58.359 The destructor needs to be called because 603 00:30:58.359 --> 00:31:01.920 In the constructor of the class, inside 604 00:31:01.920 --> 00:31:05.319 an object is sometimes made dynamically 605 00:31:05.319 --> 00:31:07.800 The destructor gets rid of them 606 00:31:07.800 --> 00:31:09.280 In other words 607 00:31:09.280 --> 00:31:12.479 The m_HP earlier in int form 608 00:31:12.479 --> 00:31:16.560 The value representing health was set in constructor 609 00:31:16.560 --> 00:31:17.839 but as this object disappears 610 00:31:17.839 --> 00:31:20.160 the value can be reset to English 611 00:31:20.160 --> 00:31:22.280 or be destroyed, and that's what it does 612 00:31:22.280 --> 00:31:25.079 So for destructor, unlike constructor 613 00:31:25.079 --> 00:31:26.119 It has no parameters 614 00:31:26.119 --> 00:31:28.280 There's no parameter 615 00:31:28.280 --> 00:31:30.479 And same for this, it provides the default 616 00:31:30.479 --> 00:31:32.719 For the call time of class 617 00:31:32.719 --> 00:31:36.839 I need to talk about the call time of constructor and destructor 618 00:31:36.839 --> 00:31:40.119 This is also related to the lifetime of the variable 619 00:31:40.119 --> 00:31:43.560 Creating an object by making a class 620 00:31:43.560 --> 00:31:46.599 is similar to creating variable a using int 621 00:31:46.599 --> 00:31:49.599 So the int a variable is created 622 00:31:49.599 --> 00:31:50.599 and destroyed 623 00:31:50.599 --> 00:31:53.599 Just like that, class is created and destroyed 624 00:31:53.599 --> 00:31:57.199 When created, copying a certain object 625 00:31:57.199 --> 00:31:58.839 is called copy constructor 626 00:31:58.839 --> 00:32:01.199 It's also influenced by inheritance structure 627 00:32:01.199 --> 00:32:02.359 I'll end the lecture here 628 00:32:02.359 --> 00:32:02.839 Thank you 629 00:32:04.557 --> 00:32:05.807 Understanding Array, Pointer, and Reference Array Data structure that makes the same data type in linear way 630 00:32:05.807 --> 00:32:06.908 For repeating the same content n times Implements algorithms such as sorting For dynamically handling data 631 00:32:06.908 --> 00:32:08.059 Pointer Expresses the address of an object Can point to variables, objects, functions, EIP 632 00:32:08.059 --> 00:32:09.310 Reference Nickname of object Reference can be made easier compared to using pointer 633 00:32:09.310 --> 00:32:10.993 Understanding Class Class Object that combines data and function All objects can be expressed in class 634 00:32:10.993 --> 00:32:12.544 Member Function Data and operation have coherence Hiding the data is possible Operator overloading function is added 635 00:32:12.544 --> 00:32:14.196 Constructor Called over when class is constructed For resetting purposes, no return Overloading is possible, default provided 636 00:32:14.196 --> 00:32:18.748 Understanding Class Destructor Called over when class is destroyed Detaches objects No parameters, default is provided 637 00:32:18.748 --> 00:32:19.748 The End