Destructors in C++

preview_player
Показать описание


Рекомендации по теме
Комментарии
Автор

Holy shit! Life saviour of a video, lecturers couldn't explain this properly in a 45 minute lecture, forums don't even answer why and when to use a destructor, and here's a short, simple 5 minute video explaining everything! Big props to you!

lobelia
Автор

I've have this habit now, I see a new video here, I hit the like button before watching since I know before hand this gonna be gud. You are doing a wonderful job! As a frequent C++ user (and I'm sure others alike can relate) even though I know more than the basics, the explanation and pacing of the concepts surrounding the topics in the videos are simple and refreshing to newcomers and regulars alike. Your work is much appreciated, keep up the awesome work good man :)

exupload
Автор

Wow, i can call the destructor manually, first time i have heard of that haha. Good video!

krec
Автор

Scrolled through your playlist and opened like 20 videos, each into a new tab. Then clicked on each tab to add it to "watch later". Every time I clicked on a new tab your "Hey what's up guys" and the arm across motion way on point lol 😂

deepwoodsengineering
Автор

Nice and neat, all tidy and clean. Very nice feature

matt-g-recovers
Автор

Loving the frequency of the videos. Hopefully this can keep up for a while so we can quickly get into the more interesting parts of the language.

MartialBarts
Автор

In this scenario, the function () is executed within the stack frame. Once the execution is complete, the stack frame is automatically destroyed, eliminating the need for a destructor in this particular case.

ghofranetorjmene
Автор

notes:

The destructor gets called every time a object gets destroyed. The destructor essentially cleans up any memory that we might have used when the object was created.

Destructors are really important when we use dynamic memory, we need to make sure that we free up the memory that we allocate on the stack when we use the object.

dxlge
Автор

Would you ever consider making an openGL c++ GUI tutorial series, Cherno? I'm interested in rolling my own for games. With features like sliders and buttons etc. Also some practical examples of how to integrate them into a simple game would be cool.

black_squall
Автор

Noted:
- Never create an object of the same class in the destructor
Love this playlist, thank you :)

ValentinKunz-di
Автор

man this is the best c++ resource! thank you so much!

typicalretard
Автор

Your tutorials are awesome! May God bless you!

nineteenn
Автор

this series is being very useful. I wish I discovered it when taking C++ class

SuheybBecerek
Автор

*My takeaways:*
1. Using destructors to avoid memory leaks 3:05
2. Call destructors manually 3:37

leixun
Автор

I can tell that destructors in modelling programs run code that saves the uninitialised data, serialised, in an array of previous operations, so that destroyed objects may be restored.

TheRojo
Автор

Would have liked to see an example with dynamic allocation, but I suppose it would have done been a repeat of stack allocation anyway. I just think lots of examples are great to help people understand better. :) still a fantastic series though! Loving it

Steven-twiz
Автор

His hair in this episode is perfect :))

cetruonghai
Автор

u can use destructors to create projectiles in games for example spells in albion online, at the end of the projectiles way it has to dissapear

_yeh
Автор

Minute 1:11, I was just wondering, even if the members are allocated in place, would it not be safer to still set them to zero upon destruction to make sure that you are leaving a clean memory for whichever software uses that memory region next?

DiegoBM
Автор

The destructor was called once when he called it explicitly and then again when the class went out of the scope of the Function() function. Am I right ?

praveshgaire