SMART POINTERS in C++ (for beginners in 20 minutes)

  Рет қаралды 104,485

CodeBeauty

CodeBeauty

Күн бұрын

Пікірлер: 232
@CodeBeauty
@CodeBeauty 3 жыл бұрын
📚 Learn how to solve problems and build projects with these Free E-Books ⬇️ C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook 🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/ Experience the power of practical learning, gain career-ready skills, and start building real applications! This is a step-by-step course designed to take you from beginner to expert in no time! 💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10). Use it quickly, because it will be available for a limited time. #include #include using namespace std; class MyClass { public: MyClass() { cout
@sivaprasanna1100
@sivaprasanna1100 2 жыл бұрын
Good video.
@codenote202
@codenote202 3 жыл бұрын
More I watch Saldina's video more I want to watch. I am assuring you it's not love it's attachment to her pace and the way she explains ❤️
@CodeBeauty
@CodeBeauty 3 жыл бұрын
❤️❤️
@markknight5178
@markknight5178 Жыл бұрын
I often find myself going back and rewatching her videos just because of how thoroughly she explains things.
@Ghisisan_
@Ghisisan_ 3 жыл бұрын
"deleting code is my favorite part". I LOLed at that one. :)
@milkamilkica1935
@milkamilkica1935 3 жыл бұрын
me 2 hahahah
@milkamilkica1935
@milkamilkica1935 3 жыл бұрын
21:06
@CodeBeauty
@CodeBeauty 3 жыл бұрын
hahahah, you are very observant, nice 😁😁
@patrickmayer9218
@patrickmayer9218 3 жыл бұрын
XD
@quicknik107
@quicknik107 9 ай бұрын
indeed
@mehmethilmiemel8937
@mehmethilmiemel8937 3 жыл бұрын
I was always getting confused about smart pointers . You helped me alot. Great JOB!!!!!!!
@CodeBeauty
@CodeBeauty 3 жыл бұрын
You're welcome! That's great to hear! ❤️
@stearking5736
@stearking5736 2 ай бұрын
Your explanations are clear and concise, making it easy to understand the principles. Many concepts that I didn't understand before became crystal clear after watching your videos. You've done an excellent job.
@CodeBeauty
@CodeBeauty 3 жыл бұрын
C# like, JavaScript comment
@dangeankit
@dangeankit 3 жыл бұрын
React ❤JS
@l.p.1967
@l.p.1967 3 жыл бұрын
c# please
@Ghisisan_
@Ghisisan_ 3 жыл бұрын
C# please.
@pkentertainment2143
@pkentertainment2143 3 жыл бұрын
C++
@astudent797
@astudent797 3 жыл бұрын
C# first then JavaScript
@unpersonownlife
@unpersonownlife 3 жыл бұрын
Great job! Unfortunately, my experience has shown that many people who deal with smart pointers need to have a rough understanding of how they work under the hood: these are stack-allocated objects that wrap pointer-like logic. This distinguishes them from the classic pointers. For example, the 'operator*' function is overridden, so that (under the hood) the * operation emulates how classic pointer work, by retrieving the REAL pointer the smart pointer OBJECT manages. But, you should always keep in mind that these are objects that refer to allocated data INDIRECTLY. When you stream the pointer using the 'operator
@StarFury2
@StarFury2 Жыл бұрын
Actually I can't even console out smart pointer using
@chip4683
@chip4683 8 ай бұрын
I really become happy whenever I search a topic and see you teaching that...
@chandranamani8469
@chandranamani8469 3 жыл бұрын
You are always strengthening my knowledge in c++ by making videos on key concepts. Your videos are very understandable.
@jyapp4489
@jyapp4489 Ай бұрын
I wish I found this video sooner, I can already see how it's useful. TYSM!
@anjalikona4487
@anjalikona4487 2 жыл бұрын
Nobody explains a hard to understand topics in a easy way like you do. THANK YOU 😌 Saldina
@cococoding1430
@cococoding1430 3 жыл бұрын
Watching from PH 🇵🇭
@CodeBeauty
@CodeBeauty 3 жыл бұрын
Greetings for you! 🇵🇭❤️
@miramuro9528
@miramuro9528 3 жыл бұрын
hi ma'am. I have been watching your videos to refresh my memory in C++, and I must say that you teach so well. thank you for this content!
@bimblebom
@bimblebom 10 ай бұрын
Beautiful! beautiful! Short succinct examples and clear short explanations.
@zepplondon
@zepplondon Жыл бұрын
Great explanation! I'm coming from Java background and was taking it's memory management for granted, but now after learning how c++ handles pointers I'm full of "a ha!" moments. Thx
@andresnaples
@andresnaples 3 жыл бұрын
Tu Español tiene un acento muy lindo. Tu eres una señorita muy inteligente , te felicito tus videos son muy buenos.
@rakshitsen5110
@rakshitsen5110 3 жыл бұрын
Great explaination ma'am
@CodeBeauty
@CodeBeauty 3 жыл бұрын
Thanks for liking 😃❤️
@rakshitsen5110
@rakshitsen5110 3 жыл бұрын
@@CodeBeauty no ma'am thanks for making this video ☺.
@ajaygunalan1995
@ajaygunalan1995 Жыл бұрын
Nice, Video! Summary: When the owner goes out of scope, the memory (object) is destroyed. unique pointers have only one owner. shared pointers have multiple owners and keep the object alive by using counting the owners. Weak pointers are not owners which means they won't keep the object alive.
@meosart1758
@meosart1758 3 жыл бұрын
C# videos would be great, thanks!
@CodeBeauty
@CodeBeauty 3 жыл бұрын
🥰🥰
@exploring_axomia
@exploring_axomia Жыл бұрын
I loved the way you have explained. Very simple and detail.
@imranshah5382
@imranshah5382 2 жыл бұрын
liked the detailed explanation of concepts and different aspects
@wjc1514
@wjc1514 2 жыл бұрын
thank you, i finally know how the weak pointer is working
@kuldeeprane1469
@kuldeeprane1469 3 жыл бұрын
Can you make video on the projects a fresher should do to include them in a resume.
@ghislain7282
@ghislain7282 3 жыл бұрын
I would like this as well, thank you mate
@CodeBeauty
@CodeBeauty 3 жыл бұрын
A few years ago I was scouted and invited to work for Google. I can share my experience related to the knowledge that was required to get a Google Software Engineer job. 😀😀
@kuldeeprane1469
@kuldeeprane1469 3 жыл бұрын
@@CodeBeauty yes mam it will be helpful for us
@shritishaw7510
@shritishaw7510 3 жыл бұрын
Honestly, all you explained in this video are phenomenal pieces of information but the way you explained it to us is marvellous. Please keep up this good work. Thanks a lot for the precise yet effective video.
@nidadursunoglu6663
@nidadursunoglu6663 Жыл бұрын
did you mean to use "and" im confused
@reina4969
@reina4969 2 жыл бұрын
I love the change to dark background.
@nikhilchourasiya4720
@nikhilchourasiya4720 2 жыл бұрын
Great job you always increase my information in cpp Thanks a lot keep uploadind video related to cpp advanced topics
@tirushsanju2917
@tirushsanju2917 3 жыл бұрын
Saldina ,Thank you help to improve my knowledge. I am proud of you 🎉️🎉️🎉️🏆️
@majdmansour1876
@majdmansour1876 2 жыл бұрын
Thank you so much for this video. I literally was studying a lecture about smart pointers and I did not understand anything at all. But now it's much better!
@kayahantasyaran6310
@kayahantasyaran6310 3 жыл бұрын
Hello Saldina. First of all, this is one of the good introductory material for smart pointers I've ever seen so far. It is very helpful. I just have a small feedback. Moving unique pointers mentioned in 6:37. It is pretty much like this but a subtle difference under the hood: std::move does just casting so that moving can be done properly with unique_ptr's move constructor. I told this because after watching that video people can think "Oh using only std::move provides moving and I don't have to think about anything else, thats good!" Thinking in that way can be misleading for further learning progress.
@oscarquiroz1904
@oscarquiroz1904 2 жыл бұрын
Amazing explanation, thanks!
@sbsyr5555
@sbsyr5555 2 жыл бұрын
Excellent Analysts... 👍
@jonathaniurman9794
@jonathaniurman9794 Жыл бұрын
So clear now! you saved me, thanks a lot!
@CodeBeauty
@CodeBeauty Жыл бұрын
Glad I could help! 🥰
@mahdibiabanpour7691
@mahdibiabanpour7691 3 жыл бұрын
Great job with different components explaining different types. The pace is very good and it lets the information settle in mind rather than rushing to write some code and wrapping up the video!
@nicholasoneal1521
@nicholasoneal1521 3 жыл бұрын
17:44 I think that at the end of the declared scope, the second pointer is going to be de-allocated and use_count() will return 1. Btw, Just saying, this is going to be really useful, I really hated having to try and figure out all the stuff with de-allocating pointers, thanks a lot, best coding channel on KZbin Edit: 24:14 I expect that wePtr1 is going to be equal to NULL
@srinadhp
@srinadhp 3 жыл бұрын
Thanks for a very detailed explanation. Very helpful!
@CodeBeauty
@CodeBeauty 3 жыл бұрын
You're welcome 😀😃
@kareemgameel150
@kareemgameel150 3 жыл бұрын
very Helpful Content i recommended your channel to my friends and My Group Community .. keep going Mrs. Saldina 💻
@astudent797
@astudent797 3 жыл бұрын
It will be great if you mam teach us both or C#
@CodeBeauty
@CodeBeauty 3 жыл бұрын
So C# first and then JS 😁😁
@astudent797
@astudent797 3 жыл бұрын
@@CodeBeauty thank you for considering both
@ApoorvSaxena8
@ApoorvSaxena8 3 жыл бұрын
Very useful content regarding c++ on whole internet
@nickchasiotis2058
@nickchasiotis2058 3 жыл бұрын
you are doing a great job. Thanks for your videos. Take care of your self, do not hit your arms again......
@CodeBeauty
@CodeBeauty 3 жыл бұрын
☺️🙏💙
@gangadharpabbineedi577
@gangadharpabbineedi577 5 ай бұрын
This is so good! Thanks a lot!
@sudhakarjawake2355
@sudhakarjawake2355 2 жыл бұрын
Great explanation. Thank You.
@antoniotonisi2419
@antoniotonisi2419 2 жыл бұрын
Thank you so much for the high quality videos.
@moizsultan5440
@moizsultan5440 3 жыл бұрын
When i started watching your vids you barely had 5k subscribers but your hard work payed off Saldina 78k wew congratulations keep growing up
@CodeBeauty
@CodeBeauty 3 жыл бұрын
I remember 🤗 Thank you! 🙏💙
@aquadap219
@aquadap219 2 жыл бұрын
this is the best channel omg
@lindeanchuang8115
@lindeanchuang8115 2 ай бұрын
Thank you very much!
@CodeBeauty
@CodeBeauty 2 ай бұрын
You're welcome!
@ynny7885
@ynny7885 Жыл бұрын
Very well explained. Thank you and happy new year.
@djordandjordanarieff2205
@djordandjordanarieff2205 2 жыл бұрын
you just gained a new follower
@moularaoul643
@moularaoul643 3 жыл бұрын
Thank you!!!
@CodeBeauty
@CodeBeauty 3 жыл бұрын
You're welcome! ❤️
@felipe_ai
@felipe_ai 3 жыл бұрын
Otro excelente video, eres la mejor profesora de C++ en KZbin :)
@CodeBeauty
@CodeBeauty 3 жыл бұрын
Te lo agradezco mucho! 😃😃
@prashanth7641
@prashanth7641 Жыл бұрын
O my goddess, Lovely tutorial. Your tutorial is as beautiful as you are. Thank you Saldina. Lots of love 💖 from Indian C++ Developers.
@vijayd595
@vijayd595 3 жыл бұрын
Hey Saldana ...I'm impressed with ur teaching...pls make session on C++ STL
@thaboleroytheosmketsu8864
@thaboleroytheosmketsu8864 3 жыл бұрын
Please do create C# videos that would be a great help
@nickyrosenberg2285
@nickyrosenberg2285 3 жыл бұрын
Thanks for your videos. They're very clear and easy to follow. And also you're smarter than a smart pointer :) Can you please make some videos about Lambda function, Template function and mutable vs const ? Thanks :)
@mjshastry7531
@mjshastry7531 2 жыл бұрын
Hey Saldina! Hope you're doing well. Great video, I really appreciate that you are making this kind of content and I feel so glad that I bumped into your channel quite a while ago. And to answer your question in the video, YES, please teach me (and your audience) how to work with C#. It would be really cool to learn from a person like you... I already enjoy your C++ videos very much (as nobody managed to clear the finicky doubts in my head as much as you could) and I very much look forward to a playlist with videos on C#. Take care... With warmest regards, Your admirer.
@gjhuang608
@gjhuang608 3 жыл бұрын
very nice teacher! Thank you!
@nastaranhendijani681
@nastaranhendijani681 8 ай бұрын
Thank you!
@robertowolfo2128
@robertowolfo2128 2 жыл бұрын
Would love a video on c++ move operations.
@patrickdavid5961
@patrickdavid5961 3 жыл бұрын
Hi Saldina, I really love your videos and I did learn a lot about C++, thanks a lot for what you do for all of us. Questions about smart pointers, OK I understand the concept... but when and in which occasion to use them? Could you explain in which occasion we should use them because to be honest I really don't know... maybe I should have use them but for me it is not obvious in which occasion I should use them. Do you have examples showing in which occasion they should be used?
@likami6830
@likami6830 2 жыл бұрын
same problem..
@davidorellana678
@davidorellana678 3 жыл бұрын
Hello Saldina. How do we know in which situations we need to use regular pointers or smart pointers?
@CodeBeauty
@CodeBeauty 3 жыл бұрын
I'm linking a stack overflow post related to your question. Hope it helps you understand better 😃😃 stackoverflow.com/questions/6675651/when-should-i-use-raw-pointers-over-smart-pointers
@vseimenazabiliblin
@vseimenazabiliblin 3 жыл бұрын
Hi Saldina, Thank you very-very much for your great work on this channel! I will be appreciate if you will make some lesson about multi-threading.
@aqdaszulfiqar443
@aqdaszulfiqar443 3 жыл бұрын
Hey u really make my CS degree easy and understandable. Can u please make a video on simple c++ projects or games ?? Atleast one project I just want to understand how can we make easy console games in c++ .
@clau9949
@clau9949 3 жыл бұрын
Would be great to make C# videos!
@koustav2008
@koustav2008 3 жыл бұрын
EXCELLENT !!!
@mirok2000
@mirok2000 2 жыл бұрын
Thanks for the video. it is nicely done. Just to clarify, in the first example, I guess the destructor would be called regardless of using smart pointer or not? !!
@AlexSmith-dh1oz
@AlexSmith-dh1oz 7 ай бұрын
any problems with doing auto ptr = std::make_unique(69); ? Saying the type twice feels kinda redundant
@sadbinmohshin7564
@sadbinmohshin7564 3 жыл бұрын
Hey codebeauty can you plz tell me which book you use to learn to code beautifully ? 🙂🙂
@mehmetacar5881
@mehmetacar5881 3 жыл бұрын
Hi saldina, i want to ask you a question. When i write the unique_ptr code in line,after line i cant use cout
@cesaraugustop
@cesaraugustop 3 жыл бұрын
Her Smile...please, Smile++!, delay(20000); Thanks, really helpful!
@akindomugisha4644
@akindomugisha4644 3 жыл бұрын
Yes please, do lessons for C# (sharp) : )
@zc7504
@zc7504 3 жыл бұрын
LUVE this!!
@yrds96
@yrds96 3 жыл бұрын
Thanks for the well explained video. I am developing a program with intent to be memory safe and smart pointers is the way Also, could you please make a video about chrono(date and time)? I've read some documentation but i cannot figure out how to efficiently work with date and time with c++
@PaulsyTharakanpptppt
@PaulsyTharakanpptppt Ай бұрын
Awesome ❤
@jackd542
@jackd542 3 жыл бұрын
What are your thoughts on the Eclipse IDE if you know about it?
@engineer6525
@engineer6525 3 жыл бұрын
thank you very much for your effort really it is not easy but can you explain how we can use them in our live programming. second can you ,if your time is available, explain how I can get the cursor (mouse) position from monitor and use it during the program running.
@alexisdelacruz6110
@alexisdelacruz6110 11 ай бұрын
Hi What is **ptr in pointer variable how is it being used in programming c++
@scalapie
@scalapie 3 жыл бұрын
Can you tell sth about difference between weak ref and strong ref? And when should we use weak pointer? Thx
@nomesa7374
@nomesa7374 8 ай бұрын
what is the use of weak_ptr? Just for observation of the dead things?
@cheetahalpha4648
@cheetahalpha4648 3 жыл бұрын
Plz make some more videos about structure data
@CodeBeauty
@CodeBeauty 3 жыл бұрын
Data structures or structured data 😁😁
@alanmichaelthayil967
@alanmichaelthayil967 2 жыл бұрын
thank you :)
@mahdavimail
@mahdavimail 7 ай бұрын
Hello this video explains smart pointers very well thanks. But it's missing the distinction between smart pointers and regular pointers. I feel I can use regular pointers instead. I just can't understand the usecase difference here. Maybe a topic for a future video. Thanks
@saifmos6516
@saifmos6516 3 жыл бұрын
Wait a bit but if you delete system("pause>nul"); you will be able to have "Destructor invoked" so that was the problem right ?
@chiyang3749
@chiyang3749 7 ай бұрын
no constructor and destructor calls from weak_ptr because it can not be used to allocate memory
@mahadifamgate2686
@mahadifamgate2686 3 жыл бұрын
Please make some video on C# specially advance topic such as Events, Delgegate, AppDomai and it's Design pattern things as they as hard part for home alone.
@haroldthibault9921
@haroldthibault9921 2 жыл бұрын
Hi from France. I've been watching quite some of your videos. That is the first one I got lost. I guess, the reason is I don't see what advantages smart pointers allow and in what situation where to use them.
@manoharsagunthalla9215
@manoharsagunthalla9215 Жыл бұрын
Dear Saldana where these share pointer etc to be used in real life programs. Please explain with example.
@vikram2975
@vikram2975 2 жыл бұрын
You are making very nice video❤ , just one suggestion keep camera focus on face .As audience , our attention goes to unnecessary hand movements
@PabloFranco1000
@PabloFranco1000 3 жыл бұрын
Hello, how to make shared_ptr return a different memory address for an X pointer each time it is called?
@alexfrozen
@alexfrozen 2 жыл бұрын
Saldina is not just developer. She is saint developer)
@CodeBeauty
@CodeBeauty 2 жыл бұрын
😅😇🥰
@agnesakne4409
@agnesakne4409 3 жыл бұрын
this video is good
@garbage1
@garbage1 3 жыл бұрын
Is there any difference between using these and using "new/delete" Im working on a program where execution speed is important as well, so is one method faster if not?
@garbage1
@garbage1 3 жыл бұрын
Awesome thanks!
@muha0644
@muha0644 3 жыл бұрын
You would not notice a difference, except you would not have memory leaks or other stupid mistakes if you use smart pointers. And trust me, execution speed is not that important. Some people use java, which is slower and doesn't even have pointers, to do time-critical things. You have to remember that computers are really fast and small differences don't usually matter. It's only if you do stupid things like 60 million else if statements in a while loop, or other stupid things like that. You can look at big O notation to see how fast algorithms perform. using smart pointers does not change the relative speed.
@tejasghone5118
@tejasghone5118 3 жыл бұрын
Can you do a video on threading in c++?
@CodeBeauty
@CodeBeauty 3 жыл бұрын
Noted, I'll add threading to my to-do list 😁😁
@johnkgeorge5263
@johnkgeorge5263 3 жыл бұрын
Pl. consider giving separate serial nos for each session (eg:Cpp001) along with the description
@aliafzal3029
@aliafzal3029 3 жыл бұрын
Hey saldena💜. I hope u r fine and living your bst life ❤️ yaa today i want to ask a little question from u its my starting in software engnerring thats why i,m asking that why programming is little boring when we start??
@CodeBeauty
@CodeBeauty 3 жыл бұрын
Probably because you just started. It's the same way when you learn to play an instrument. You can have a lot of fun and play good music only after you learn to play well 🤔🤔😃💜
@aliafzal3029
@aliafzal3029 3 жыл бұрын
@@CodeBeauty Thankyou so much for reply.
@chanduchanti8775
@chanduchanti8775 2 жыл бұрын
can you explain , how to use unique pointer for files ?
@RK-vm6eu
@RK-vm6eu 3 жыл бұрын
what are the difference and similarities between weak pointer and unique pointer same ?
@willrose6182
@willrose6182 2 жыл бұрын
Something I don't really understand though is how to pass smart pointers to other functions - I know I can pass them the same way as a raw pointer, but I've heard passing by reference is preferred. So if I defined a smart pointer (lets say a unique ptr) and then dereferenced it and passed the dereferenced value to a function which was taking a reference, would this then break the smart pointer or is that fine? Can I then assign to this reference? Thank you for the video though!
@granumuse7847
@granumuse7847 3 жыл бұрын
As the two shared pointers are created in that scope, after that scope at line 23 we should get null pointer exception. Let's see what really happens...
@HOWTO-sf6sy
@HOWTO-sf6sy 3 жыл бұрын
Mam I want data structures and algorithms full course in c++ like you have uploaded c++ for beginners full country earlier Please mam do it 🙏
@rakshitsen5110
@rakshitsen5110 3 жыл бұрын
Ma'am please explain SQl tooo please.
@keivanmorady
@keivanmorady 3 жыл бұрын
Why one may need a weak pointer? I wished you explained that part a bit more.
Exception handling in C++ (How to handle errors in your program?)
24:46
Why no RONALDO?! 🤔⚽️
00:28
Celine Dept
Рет қаралды 51 МЛН
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 88 МЛН
كم بصير عمركم عام ٢٠٢٥😍 #shorts #hasanandnour
00:27
hasan and nour shorts
Рет қаралды 8 МЛН
Destructors in Programming: Practical Demonstration
20:10
CodeBeauty
Рет қаралды 35 М.
Smart Pointers in C++ (Stop Using new?)
17:18
Caleb Curry
Рет қаралды 13 М.
you will never ask about pointers again after watching this video
8:03
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 825 М.
Why no RONALDO?! 🤔⚽️
00:28
Celine Dept
Рет қаралды 51 МЛН