1
00:00:00,610 --> 00:00:03,280
Destructors in C plus plus.

2
00:00:03,280 --> 00:00:07,900
So an object's destructor is its cleanup function.

3
00:00:07,910 --> 00:00:12,940
So the destructor is invoked before an object is destroyed.

4
00:00:12,940 --> 00:00:19,870
So destructors are almost never called explicitly so the compiler will ensure that the each object's

5
00:00:19,870 --> 00:00:22,840
destructor is called as appropriate.

6
00:00:22,840 --> 00:00:33,550
So you declare a class destructor with a tiled here tiled followed by the name of the class here tiled

7
00:00:33,550 --> 00:00:34,210
here.

8
00:00:35,000 --> 00:00:37,250
Uh, my date and time.

9
00:00:37,580 --> 00:00:39,920
This way you can set the distractor here.

10
00:00:41,010 --> 00:00:41,610
So.

11
00:00:43,250 --> 00:00:46,940
Here we declare the my date and time destructor.

12
00:00:46,970 --> 00:00:53,810
So here, let's let's write some code here that will.

13
00:00:54,850 --> 00:00:58,420
Tell us when the object will print.

14
00:00:58,420 --> 00:01:05,320
Some will print something on the console screen when our object is distracted here.

15
00:01:05,830 --> 00:01:11,680
Object this distracted here.

16
00:01:11,790 --> 00:01:15,220
So defining this destructor is optional.

17
00:01:15,220 --> 00:01:20,830
So if you decide to implement a destructor, it must not take any arguments.

18
00:01:20,860 --> 00:01:28,090
Examples of actions you might want to take in a destructor include releasing file handler handlers,

19
00:01:28,090 --> 00:01:31,780
flushing network sockets and freeing dynamic objects.

20
00:01:31,780 --> 00:01:37,420
So if you don't define a destructor, a default destructor is automatically generated.

21
00:01:37,420 --> 00:01:42,190
So the default destructors behavior is to perform no action.

22
00:01:42,190 --> 00:01:48,640
So you will you will learn a whole lot more about Destructors in the next lectures.
