OOP Constructors - Types of Constructors You Need to Know (Basics to Mastery)

  Рет қаралды 44,320

CodeBeauty

CodeBeauty

Күн бұрын

📚 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.
☕ If you've found my content helpful and would like to support me, you now have the option to buy me a coffee or a cookie! It's a small gesture of gratitude that means a lot to me and helps me keep creating free educational videos for you. You can use the link below to make a contribution: bit.ly/CodeBeauty_BuyMeACoffee
However, please don't feel obligated to do so. I appreciate every one of you, and I will continue to share valuable content with you regardless of whether you choose to support me in this way. Thank you for being part of the Code Beauty community! ❤️😇
👉In this video, you will learn about constructors in object-oriented programming, starting with an approach without constructors and then moving on to the different types of constructors, including default and parametrized constructors.
We'll also cover six important rules to keep in mind when working with constructors, and how non-member functions are used.
To reinforce your learning, I'll provide an example for you to develop logic, along with a task to practice.
I'll also highlight important tips and errors that can occur when working with constructors.
In the end, there is a special surprise for you.
Watch the entire video to gain a comprehensive understanding of constructors and their role in object-oriented programming.
👉 Download a 7-day free trial from the PVS-Studio website or get an exclusive 30-day fully functional license for free by entering the 'code_beauty' promocode or use this link:
bit.ly/PVS-StudioFreeCB1
Contents:
00:00 - Introduction
01:31 - Approach without constructors
03:34 - Example for you to develop logic
08:22 - Default Constructors
10:04 - 6 Important Rules About Constructors
16:06 - Parametrized Constructor
20:31 - Non-Member Functions
22:14 - Task for You to Practice
23:23 - Important Tips and Errors That Can Occur
27:24 - Special Surprise & Gift for You
Related videos to watch:
Operator overloading: • C++ Operator Overloadi...
Learn more about constructors: • C++ OOP (2020) - What ...
Copy constructors: • C++ Copy constructors ...
Destructors: • Destructors in Program...
Add me on other platforms:
Instagram 📸 - / truecodebeauty
Twitter 🐦- / truecodebeauty

Пікірлер: 122
@CodeBeauty
@CodeBeauty Жыл бұрын
📚 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.
@Relaxingmusic-nk7py
@Relaxingmusic-nk7py Жыл бұрын
The way you explain is awesome ❤❤❤ lots of love for you teacher. I was never expected one day I will find a teacher who will explain awesome way . I don't have words to express my happiness after watching your vedios 🎉🎉🎉🎉
@874D8
@874D8 2 ай бұрын
I love this serie. It is so thorough and no time is wasted.
@cophnia61
@cophnia61 Жыл бұрын
I already love your lessons about C++ but with this addition I think it just became perfect!
@CodeBeauty
@CodeBeauty Жыл бұрын
Much appreciated, thank You.
@nv9usb381
@nv9usb381 Жыл бұрын
I have never seen such a good, in-depth explanation before. Programming classes used to make me anxious before I discovered your channel, but now I understand everything and I am looking forward to them. I wish I had found your channel earlier because your explanations are so clear. You are absolutely right when you say that programming isn't hard.
@CodeBeauty
@CodeBeauty Жыл бұрын
Thank You, it means a lot to receive positive feedback ❤
@Stisse12
@Stisse12 2 ай бұрын
This is the best tutorial on Constructors I seen so far. Seen 4 videos on the topic, but noone explain why and a good example where to use it.
@deneristargerian6755
@deneristargerian6755 Жыл бұрын
Thanks to your videos I finally understand programming, and I even got internship job. Thank you Saldina, thank you ❤❤
@CodeBeauty
@CodeBeauty Жыл бұрын
That's so good to hear, keep learning ❤
@salihbarknakkaya8101
@salihbarknakkaya8101 2 ай бұрын
Another day, another video for me, lets have all the enjoy and love coding again! And of course as before, greetings to the best teacher ever for these beautiful videos!
@milkamilkica1935
@milkamilkica1935 Жыл бұрын
amazing as always! thank you saldina
@CodeBeauty
@CodeBeauty Жыл бұрын
My pleasure!!
@GSD549
@GSD549 Жыл бұрын
Saldina you are simply perfect❤️
@CodeBeauty
@CodeBeauty Жыл бұрын
that's so nice of you
@anwar6971
@anwar6971 Жыл бұрын
Thanks for good explanation.
@CodeBeauty
@CodeBeauty Жыл бұрын
You are very welcome
@hindustaniyodha9023
@hindustaniyodha9023 Жыл бұрын
Much much needed video.
@CodeBeauty
@CodeBeauty Жыл бұрын
much much thank you ❤
@gollygobih6527
@gollygobih6527 Жыл бұрын
Your content is the best. All the programming I've learned, I learned it from you. Thanks Saldina
@phoebewell3653
@phoebewell3653 Жыл бұрын
Finally, you are back. Great video, I was waiting for this!
@CodeBeauty
@CodeBeauty Жыл бұрын
More to come!
@jamalkhan_
@jamalkhan_ Жыл бұрын
What a coincidence , I was taught about this concept just today in the University.
@CodeBeauty
@CodeBeauty Жыл бұрын
am I master of timing or what? 😉
@mohankumarparamas
@mohankumarparamas Ай бұрын
your explanation of constructor is clear and beautiful
@CodeBeauty
@CodeBeauty Ай бұрын
🥰🥰
@dundyd3612
@dundyd3612 Жыл бұрын
I love your lessons. I always understand everything 🚀🚀
@CodeBeauty
@CodeBeauty Жыл бұрын
Glad you like them!
@dastin7276
@dastin7276 9 ай бұрын
Your instruction is consistently excellent. Thank You.
@user-jp5ci5tl5n
@user-jp5ci5tl5n 2 ай бұрын
your vedios are just so amazing and thorough, and you have the perfect small sense of humour 🤭 which makes my mood amazing. thank you saldina. i love you.
@muhammadaon9147
@muhammadaon9147 Жыл бұрын
Finally found someone who is specifically focusing on c++ Love from Pakistan ❤️❤️
@CodeBeauty
@CodeBeauty Жыл бұрын
Love for Pakistan ❤ 🇵🇰
@ibrahimmoufawad2988
@ibrahimmoufawad2988 Жыл бұрын
Thank you trillions of times! Your explanation was incredibly clear and easy to understand. I really appreciate your help!
@CodeBeauty
@CodeBeauty Жыл бұрын
You're very welcome! 🥰❤️
@andriy_bondarenko
@andriy_bondarenko 10 ай бұрын
Thank you, so clear and beautiful as always!
@Lisa-mh1dk
@Lisa-mh1dk Жыл бұрын
thank youuu, u explain things really well!
@marym9003
@marym9003 Жыл бұрын
I'm in and I can't wait for your course! I know it will be amazing!!! 🔥🔥💰
@CodeBeauty
@CodeBeauty Жыл бұрын
Fantastic!
@amadoujallow4354
@amadoujallow4354 3 ай бұрын
How is the course ?
@hristijanp.8500
@hristijanp.8500 7 ай бұрын
Hvala ti puno, jako olesnitelno je kad ima ko da objasni. Top si!
@CodeBeauty
@CodeBeauty 2 ай бұрын
Hvala tebi na komentaru ❤️
@asidadon9228
@asidadon9228 7 ай бұрын
Hi Saldina , i'm learning so much from your videos, you are the best! Thanks
@CodeBeauty
@CodeBeauty 2 ай бұрын
I'm happy to hear that ❤️
@programtin
@programtin Жыл бұрын
saldina you are the perfect teacher.
@VikramKumar-di6dj
@VikramKumar-di6dj Жыл бұрын
Glad I didn't missed the last part 😄
@Brusselsprouts2023
@Brusselsprouts2023 2 ай бұрын
wish this video has more views so mire people can understand in depth.
@CodeBeauty
@CodeBeauty 2 ай бұрын
Share it with your friends then. Together, you can learn to code a start a great tech company 🥰
@davidmorris2848
@davidmorris2848 Жыл бұрын
Thank you for all of your hard work! I am so excited for your course to come out, I've been saving up so I can purchase it on day one. Would you mind telling us if its going to cover anything about c++ builder?
@CodeBeauty
@CodeBeauty Жыл бұрын
Thank you so much for your support and enthusiasm for my course, it means a lot! For this course we won't cover C++ builder because it is paid software and i wanted to use only the free tools so that it is accessible for everyone and that's why we will use Visual Studio. I promise the skills you'll learn will be useful in different programming languages and environments. Plus, it won't be expensive and since I cannot put in words how much I appreciate you saving up for my course here is link where you can subscribe and get a discount when I publish it: bit.ly/SimplifyingCoding. See you there
@davidmorris2848
@davidmorris2848 Жыл бұрын
@@CodeBeauty Thank you for getting back with me. I like c++ builder but I would prefer to learn Visual Studio, so that is exciting. I already signed up, but I encourage everyone to do the same. 😁
@prasannapm3220
@prasannapm3220 9 ай бұрын
Thank you
@madhusankawijerathne8435
@madhusankawijerathne8435 Жыл бұрын
Thank you!!
@oxamic9953
@oxamic9953 11 ай бұрын
THANKS!
@yusraazrademirel2195
@yusraazrademirel2195 Жыл бұрын
THANK YOU
@othmanghandour3445
@othmanghandour3445 Жыл бұрын
You're great teacher, really adorable explanation, can we get another video about Initialization lists, Delegating Constructors, Copy Constructors, also constructors type...............it never ends 😭😭
@AhmedRaza-ty7zq
@AhmedRaza-ty7zq 10 ай бұрын
Awesome video😎😎👍👍
@HaroldSchranz
@HaroldSchranz Жыл бұрын
Awesome!
@CodeBeauty
@CodeBeauty Жыл бұрын
😁❤️
@AlphaRocketLeo
@AlphaRocketLeo Жыл бұрын
Really Good Explaination ❤
@CodeBeauty
@CodeBeauty Жыл бұрын
Thanks you, it is truly heartwarming to know that me sharing my knowledge and passion for programming helped you. Teaching and helping others is incredibly rewarding, and it gives me a sense of purpose and fulfillment that can't be matched ❤.
@AlphaRocketLeo
@AlphaRocketLeo Жыл бұрын
@@CodeBeauty yeah you explain very well and best way to deliver every part
@iNeurons
@iNeurons Жыл бұрын
Again learn with brain beauty 😍
@CodeBeauty
@CodeBeauty Жыл бұрын
@abelashenafi6291
@abelashenafi6291 7 ай бұрын
Great content. My question is which keyboard shortcut have you used @ 25:17 to comment the block of code? Thanks the content is amazing
@moeezabdul2000
@moeezabdul2000 Жыл бұрын
Hey, Saldina could make a C++ videos on Desing Patterns? How they Work? What is the Purpose of them? Why we do we need them? How we can implement them into our applications. BTW, Great Video, LIKED!
@AlphaRocketLeo
@AlphaRocketLeo Жыл бұрын
It's work me alot when i go for interview
@CodeBeauty
@CodeBeauty Жыл бұрын
Glad to help, my pleasure ❤
@oyeenamdev8867
@oyeenamdev8867 2 ай бұрын
Loved the way you teach :) thanks @CodeBeauty
@CodeBeauty
@CodeBeauty 2 ай бұрын
Glad it was helpful!
@bashiraddean-mufarreh
@bashiraddean-mufarreh Жыл бұрын
I completed a simple project from what I learned during my follow-up to your lessons, and I sent a copy of it to your mail. Please take a look, for help, advice and your opinion. Thank you from Yemen
@riachii3333
@riachii3333 Жыл бұрын
hello saldina! thank you for the videos, i have a question please explain to me! lets say i made a user info constructor like you did in the video, but instead of entering my own parameter values like name and last name, i want the users themselves to enter their info into the parameters. how can i do that? please explain to me!!
@gower1973
@gower1973 Жыл бұрын
It’s just printing out whatever’s in the uninitialised memory, I was surprised it ran the first time, I thought it would throw out a null reference exception, but it probably worked because of the default constructor
@CodeBeauty
@CodeBeauty Жыл бұрын
yes, you are absolutely correct, thanks to the default constructor everything works fine.
@codingSparrow143
@codingSparrow143 8 ай бұрын
@CodeBeauty I have a question. I tried to run the first program without initializing a 'test' varoable and didn't get any error. why is that? at 7:43 in the video. thanks in advance.❤❤❤
@kemaleesgerova9205
@kemaleesgerova9205 Жыл бұрын
❤çox sağ olun
@aaronsj80
@aaronsj80 Жыл бұрын
I kind of miss programming in C++. I'm a full time developer and we don't use C++ at my company. I have my own home projects in C++ that need working on, I just never feel like it after spending the day working on other people's code, so I go months at a time without working on the projects I'd like to finish. BTW, how's the kitten doing?
@CodeBeauty
@CodeBeauty Жыл бұрын
I completely understand how you feel! When I used to work as a programmer for other companies, I often found myself too exhausted to work on my personal projects outside of work hours. It can be tough to stay motivated when you've spent all day working on code, but i would strongly encourage you not to give up on your passion for C++. Try dedicating some time, an hour per day or whatever you find comfortable to spare it for something that's making you happy because, in the long run, it's more important than any material gain. As for the Miso, he's currently sleeping in the box next to heavenly cozy pillow, go figure 😊. He is regular attraction on my IG so check it out here instagram.com/truecodebeauty/
@aaronsj80
@aaronsj80 Жыл бұрын
@@CodeBeauty Unfortunately I wasn't able to scroll far in your Instagram before it asked me to log in and I'm not really interested in making an account. I'm glad to hear the kitten is doing well though. It's always good to know that pets are happy.
@user-fm2tm8xc8e
@user-fm2tm8xc8e 8 ай бұрын
but i'm getting value of test without initializing it in local variable..? tell me please...?
@dastin7276
@dastin7276 Жыл бұрын
Impressive and certainly very useful but to pass a strict Turing test (it seems) more advancement is required.
@CodeBeauty
@CodeBeauty Жыл бұрын
In order to create a machine that will pass the Turing test, you first need to have a good understanding of basic programming concepts, and be able to grasp them in depth through practice. Afterwards, it is essential to upgrade your knowledge with an understanding of artificial intelligence, machine learning algorithms, natural language processing techniques, and other related concepts. You have made a good decision by choosing C++ for this endeavor, as it is a high-performance programming language that is utilized in many complex systems, including artificial intelligence. ❤
@vigenxcchatryan8742
@vigenxcchatryan8742 4 ай бұрын
where can we find your practical course?
@CodeBeauty
@CodeBeauty 2 ай бұрын
The course is out, and you can find it here: www.codebeautyacademy.com
@khang-0
@khang-0 2 ай бұрын
I have a question!! when you invoke "void GetUserInfo(User u)" function, you pass by value, right? And you don't have copy constructor. How that can work?
@CodeBeauty
@CodeBeauty 2 ай бұрын
You need copy ctors only if your class has pointers. Otherwise, it can be copied even without a copy constructor 😊
@khang-0
@khang-0 Ай бұрын
@@CodeBeauty
@ali_youtube_user_7351
@ali_youtube_user_7351 3 ай бұрын
Using uninitialized variables causes UB (Undefined Behavior). This becomes dangerous when it comes to uninitialized pointers because it could cause segmentation fault (don't forget nullptr :))
@bhargav3350
@bhargav3350 Жыл бұрын
please complete all c++ topics,
@CodeBeauty
@CodeBeauty Жыл бұрын
Will do, no worries. I'm spending all of my time in creating educational programming content and most of it you can find for free here on my youtube channel, and there is a lot more to come. In addition, my guess is that you will be happy to learn that I'm also working on something very special, my own practical programming course where I'm walking you through most important programming concepts and teaching you how to implement them on real application. It will be packed with practical knowledge, so go ahead, use this link bit.ly/SimplifyingCoding to leave me your email and as a token of my appreciation, I will send you a special discount when the course is launched. ❤️
@maheshvelugula8418
@maheshvelugula8418 Жыл бұрын
please we need videos about CPP REST SDK ---(client & server) 🙃
@CodeBeauty
@CodeBeauty Жыл бұрын
as soon as there is enough demand I will, for sure, but in the meantime I'm trying to focus on topics that are most requested by my community. 🤞
@rwagasanaelisa1379
@rwagasanaelisa1379 10 ай бұрын
thanks for your toturial but we need more examples to understand it better because we are begginners
@AhmedRaza-ty7zq
@AhmedRaza-ty7zq 10 ай бұрын
7:50 the test variable is not initialized in the main().🤔🤔
@leep7562
@leep7562 Жыл бұрын
how long has it been 🥺🥰
@CodeBeauty
@CodeBeauty Жыл бұрын
Too long, I know, but it was for good reason. I'm working on my Practical Programming course and if you liked my content so far than believe me when I tell You that You will enjoy this. Subscribe here bit.ly/SimplifyingCoding not to miss it and to also get nice discount soon when I publish it. Cheers
@shivamdubey3259
@shivamdubey3259 3 ай бұрын
😄😄😄😇
@CodeBeauty
@CodeBeauty 2 ай бұрын
😁😁
@ayan92adak
@ayan92adak Жыл бұрын
you could have sent the "User" using const ref
@CodeBeauty
@CodeBeauty Жыл бұрын
Yup, const would ensure that the function will not change it, just print its value
@AhmedRaza-ty7zq
@AhmedRaza-ty7zq 10 ай бұрын
5:17 This program will not print the first name, last name, age, and Email.
@jorgetorres1670
@jorgetorres1670 Жыл бұрын
ok
@iaonyt
@iaonyt Жыл бұрын
Glad to see some quality content after the shorts lol
@CodeBeauty
@CodeBeauty Жыл бұрын
all work and no fun is bad for health 🤭
@Lukas-ft6te
@Lukas-ft6te Жыл бұрын
Hey, I was just wondering what is your height? I'm conducting a survey for a school project.
@CodeBeauty
@CodeBeauty Жыл бұрын
Hahahaha, I'm 175cm, where do I stand on the charts 😅😁
@Lukas-ft6te
@Lukas-ft6te Жыл бұрын
@@CodeBeauty top 7 percent
@user-jz4yp4sv7p
@user-jz4yp4sv7p 2 ай бұрын
reason is that you have not initialized
@hamzaergin
@hamzaergin 9 ай бұрын
i don't like ads
@antonschindler7304
@antonschindler7304 Жыл бұрын
Please no more click bait
@user-jz4yp4sv7p
@user-jz4yp4sv7p 2 ай бұрын
there will be errors
@mardiyonghasben1619
@mardiyonghasben1619 Жыл бұрын
goodluck....miss codebeauty...
@CodeBeauty
@CodeBeauty Жыл бұрын
Thank You ❤
@yon1623
@yon1623 Жыл бұрын
wome coding? things you see online on youtube.
@CodeBeauty
@CodeBeauty Жыл бұрын
Well, if women shouldn't code, who's going to fix all the bugs in your code? 😁
@milesbradford6096
@milesbradford6096 3 ай бұрын
You are completely out of focus on all four corners and what you type seems to be fuzzy at best. Thanks. Sorry.....My bad....Only up to 3:52 is fuzzy....Now it seems ESP has made it focus after all. Thanks again for your work.
@danny12345
@danny12345 Жыл бұрын
Thank you
@CodeBeauty
@CodeBeauty Жыл бұрын
You're welcome 🥰
Destructors in Programming: Practical Demonstration
20:10
CodeBeauty
Рет қаралды 30 М.
How to bring sweets anywhere 😋🍰🍫
00:32
TooTool
Рет қаралды 34 МЛН
Шокирующая Речь Выпускника 😳📽️@CarrolltonTexas
00:43
Глеб Рандалайнен
Рет қаралды 11 МЛН
Чай будешь? #чайбудешь
00:14
ПАРОДИИ НА ИЗВЕСТНЫЕ ТРЕКИ
Рет қаралды 2,8 МЛН
WHY did this C++ code FAIL?
38:10
The Cherno
Рет қаралды 152 М.
Bjarne Stroustrup: C++ | Lex Fridman Podcast #48
1:47:13
Lex Fridman
Рет қаралды 1 МЛН
SMART POINTERS in C++ (for beginners in 20 minutes)
24:32
CodeBeauty
Рет қаралды 93 М.
Copying and Copy Constructors in C++
20:52
The Cherno
Рет қаралды 418 М.
C# Variables and Data Types (beginners programming tutorial)
32:39
Coding Was Hard Until I Learned THESE 5 Things!
7:40
Pooja Dutt
Рет қаралды 997 М.
Object Oriented Programming (OOP) in C++ Course
1:30:26
freeCodeCamp.org
Рет қаралды 2,4 МЛН
КОПИМ НА АЙФОН В ТГК АРСЕНИЙ СЭДГАПП🛒
0:59
Урна с айфонами!
0:30
По ту сторону Гугла
Рет қаралды 5 МЛН
Best Beast Sounds Handsfree For Multi Phone
0:42
MUN HD
Рет қаралды 341 М.
Will the battery emit smoke if it rotates rapidly?
0:11
Meaningful Cartoons 183
Рет қаралды 9 МЛН