Casting in C++

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


Thank you to the following Patreon supporters:
- Dominic Pace
- Kevin Gregory Agwaze
- Sébastien Bervoets
- Tobias Humig
- Peter Siegmund
- Kerem Demirer

Gear I use:
-----------------

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

After watching accidentally a video of yours, I found you an awesome teacher and I've completed the whole series in a matter of days, never gets boring.
You really motivated me to seriously learn this language (I did know most basic things but was lazy and stopped), I hope you continue doing videos, trust me it's going to be a very valuable library.

naoufal
Автор

Such a modest energy and I can actually understand what you're saying. Thanks!

jaesiraki
Автор

I am happy you make these videos. Because I study Computer Science in my university and it really helps me understand information which I didn't get in my class

work
Автор

Sir, now We need more advanced c++ series from a great guy like you, many many thanks👍🙏🙏..

chinmaydas
Автор

static_cast also helps to avoid removing constantness that can be easily done through c-style casting

KostasOreopoulos
Автор

*My takeaways:*
1. Implicit and explicit casting - C style 1:53
2. Static cast - C++ style 4:15
3. Why we want to use C++ style cast 4:44
4. Dynamic cast - C++style 8:44

leixun
Автор

You explain very well. And youre the only one who doesn't use mac book.

sonulohani
Автор

I've read somewhere, that it's actually faster and more efficient to use the C++-style casting, because if you use the "old style" casting, the modern compiler will try to attempt every c++-style casting in turn (const -> static -> reinterpret) and return the result of the first successful cast. But if you use one of them explicitly yourself, you just do it directly, without extra steps.

xonxt
Автор

Thanks a lot, your videos are always the easiest to understand :)

redwing
Автор

Appreciate the awesome series so far. I still reference your videos when I'm not 100% sure why something works. Anyways.

REQUEST: Could you do a video on std::string_view vs. std::string, and when to prefer to use one or the other?

SoloR
Автор

another drawback of (C)style casts is that they will attempt every cast type until one works, meaning the result won’t necessarily be what you expect

itsmaxim
Автор

It's amazing. I have been using C++ for half a decade and written quite a few rather complex programs, yet there are still features I didn't know, lol.

gayusschwulius
Автор

An important point that I realized looking at my casted variable types, the variables do not actually change to the casted types, only the data is changed. So the variable doubleVar = 5.5, will send 5 when casted as an int, but it still remains a double.

Miketar
Автор

Any updates on the dynamic casting video? Really interested in this as well as further information on RTTI and reflection in C++. Not something that is clearly and concisely explained online! Thank you for all your helpful videos.

erikeviston
Автор

I can't believe how accessibly you explained this

parabalani
Автор

Although I'm making some effort to learn C++ style casts, I also prefer C-Style casts. The only thing that C++ style casts ( a part from dynamic_cast) have useful is improving code readability, but I see them somewhat confusing. Working with C-Style cast is far easier.

MrHelio
Автор

8:20, no actually your explanation was perfect and very understandable. thank you

darthnegativehunter
Автор

Could you make a video about memory allocators, like memory arenas?

stewartzayat
Автор

Hi Cherno! I am currently studing at 42 school, and your videos are so helpfull. So you know!

pablo
Автор

Any chance you can go more indepth with c++?
E.g Software patterns, etc, how to structure/organise code, superclasses or not, how to achieve loose coupling etc.
I feel all of this basic stuff has been done, its all over youtube, the horse is not beaten...its a wet pulp at this point :D Just a hint for future content!

syntaxed