1
00:00:00,440 --> 00:00:02,960
Plain old data classes.

2
00:00:02,960 --> 00:00:07,760
So classes are user defined types that contain data and functions.

3
00:00:07,760 --> 00:00:11,830
So and they are the heart and soul of C plus plus.

4
00:00:11,840 --> 00:00:15,710
So the simplest kind of classes are plain old data classes.

5
00:00:15,740 --> 00:00:16,790
Pods.

6
00:00:16,790 --> 00:00:19,250
So pods are simple containers.

7
00:00:19,280 --> 00:00:25,700
Think of them as a sort of heterogenous array of elements and potentially different types.

8
00:00:25,700 --> 00:00:28,760
So each element is called a member.

9
00:00:28,760 --> 00:00:35,930
So every pod begins with the keyword struct here followed by the pods name.

10
00:00:35,930 --> 00:00:38,930
So let's create a car struct here for example.

11
00:00:39,350 --> 00:00:42,980
So next you list the members types and names.

12
00:00:42,980 --> 00:00:48,380
So for example character here name.

13
00:00:49,420 --> 00:00:53,260
Here or make here.

14
00:00:53,950 --> 00:00:55,360
Integer here.

15
00:00:55,450 --> 00:00:58,510
Integer does.

16
00:00:58,510 --> 00:00:59,200
Or.

17
00:01:00,070 --> 00:01:00,940
Wheels.

18
00:01:02,380 --> 00:01:03,100
Here.

19
00:01:05,960 --> 00:01:08,240
And the boolean here, let's assign.

20
00:01:08,240 --> 00:01:10,640
Boolean is running.

21
00:01:11,580 --> 00:01:13,800
Here then.

22
00:01:14,830 --> 00:01:15,340
Here.

23
00:01:15,340 --> 00:01:25,930
As you can see here, a single car struct contains a character array called make an integer here, integer

24
00:01:25,930 --> 00:01:29,590
wheels and bool is running boolean.

25
00:01:29,590 --> 00:01:34,660
So you declare the variables just like any other variables by type and name.

26
00:01:34,660 --> 00:01:41,080
So you can then access the members of the variable by using the dot operator.

27
00:01:41,080 --> 00:01:41,770
So.

28
00:01:41,770 --> 00:01:48,760
So first let's first declare a car variable here.

29
00:01:51,390 --> 00:01:52,950
Car here.

30
00:01:55,290 --> 00:02:03,900
My my BMW here and then my BMW that is running.

31
00:02:03,930 --> 00:02:06,810
Let's assign is running to um.

32
00:02:07,020 --> 00:02:08,010
For example.

33
00:02:08,040 --> 00:02:08,740
True.

34
00:02:08,820 --> 00:02:09,330
Yeah.

35
00:02:09,360 --> 00:02:11,460
My BMW is running for example.

36
00:02:12,270 --> 00:02:13,080
True.

37
00:02:14,630 --> 00:02:24,080
Here and my BMW cannot make or sort of year is 2001 here.

38
00:02:24,110 --> 00:02:26,570
This is all BMW and.

39
00:02:27,640 --> 00:02:28,120
Here.

40
00:02:28,120 --> 00:02:31,330
Finally, let's print the message here.

41
00:02:31,330 --> 00:02:34,870
Print f is my or.

42
00:02:36,330 --> 00:02:39,810
My BMW year here.

43
00:02:42,220 --> 00:02:43,030
The.

44
00:02:43,300 --> 00:02:44,440
And.

45
00:02:46,240 --> 00:02:48,670
My bmw.here.

46
00:02:49,390 --> 00:02:51,190
And let's print this.

47
00:02:53,060 --> 00:02:55,370
Here, as you can see here.

48
00:02:55,370 --> 00:03:08,000
Finally, you will print a message and extract the number or extract the year of my car using this dot

49
00:03:08,000 --> 00:03:09,110
operator here.

50
00:03:09,110 --> 00:03:17,600
So pods have some useful low level features so they are C compatible and you can employ machine instructions

51
00:03:17,600 --> 00:03:21,080
that are highly efficient to copy or move them.

52
00:03:21,080 --> 00:03:24,380
So and they can be efficiently represented in the memory.

53
00:03:24,380 --> 00:03:31,460
So C plus plus guarantees that members will sequential in memory, although some implementations require

54
00:03:31,460 --> 00:03:33,830
members to be aligned along word boundaries.

55
00:03:33,830 --> 00:03:37,370
So which depends on the CPU register length.

56
00:03:37,370 --> 00:03:47,150
So as a general rule, you should order members from largest to smallest within pod definitions.
