Lecture 71: Constructor and Destructor in C++
Вставка
- Опубліковано 26 лип 2024
- Introduction to OOPs | Constructor in C++ | Destructor in C++ | Default Constructor | Parameterized Constructor | Copy Constructor | Inline Constructor | Constructor Overloading
Home work sheet: drive.google.com/drive/folder...
Join Our Whatsapp Channel: whatsapp.com/channel/0029Va6H...
Day 100/180, #180daysofcode #180 hard
We are doing 180 days challenge and going to complete the whole course within the duration with quality content on UA-cam. I am on the mission to create a tech revolution in our country and in upcoming future we want to create a tech which will create many jobs in India.
Video will come on Mon-Fri at 6am in the morning
DSA Course for free
C++ Free Course
Rohit Negi DSA Course C++
Coder Army DSA Course c++
Function in C++
Pointers in C++.
Strings
Vector
Introduction to Recursion
Time stamps :
0:00 Introduction
1:12 Constructors
4:45 Default Constructor
9:00 Parameterized Constructor
15:10 This Pointer
17:38 Constructor Implementation
25:57 Constructor Overloading
28:16 Inline Constructor
34:46 Copy Constructor
44:07 Value Assignment with Assignment Operator
44:50 Destructor
56:50 Constructor & Destructor Call Order
connect to me on Instagram: rohit978.page.link/insta
Linkedin: rohit978.page.link/linkedin
Telegram: rohit978.page.link/telegram
Good Morning, thoda Schedule Hectic ho rkha hai, Subha 4am video banaya hai, fr edit wgera hua, isly 7.30am tak video aaya hai, Baaki Time Stamp Add kar dena aap, it will help other also.
Koi baat nahi bhaiya
Bhaiya koi baat nahi lecture late bhi aa jaye kuchh din but aapki health jada important hai ❤
Vaiya lagtahe ki 180 day 360 hoga
@@machinecode2.047 bhai day count mat karo bhaiya bahut afforts daal rahe hai chahe jab bhi khatam ho, aur bhai quality dekho kitna achha explain karte hai, inse bhi yahi ummid rakhoge ki jaldi jaldi to baki youtubers ki tarah hi ho jayga.
good work
Kya mast padhate hai bhaiyya 🫡💪. Maan gayi yaar sach mein. Mere college mein bohot baar repeat kr kr ke padhaya tha constructor lekin feel hi nahi aayi thi uski bilkul. Bhaiyya ki vajah se samjha poora.
00:02 Constructor is a special function invoked at object creation.
02:16 Creating and using objects in C++
07:26 Constructors in C++ allow for initializing object values.
09:29 Understanding the constructor in C++
14:47 Understanding initialization of account number and implications of storing data
17:12 Understanding constructors and default constructor in C++
21:46 Understanding constructor and its parameters in C++
23:48 Creating and using constructors in C++
27:54 Understanding the role of the this pointer in storing the address of the calling object.
30:00 Constructor cannot be re-declared and can be used for initializing values
33:21 Constructor in C++ is for resource initialization and managing
35:10 Creating a copy constructor in C++ and its significance
39:02 Understanding the call sequence of the copy constructor.
40:45 Copy constructor is called to copy objects in C++.
44:48 Destructor is the last function called before an object is destroyed.
47:11 Constructor allocates memory and initializes value, Destructor releases memory
51:17 Destructors release memory locations and resources when the program ends.
53:24 Destructor is used to release resources and is automatically created by the compiler if not defined manually.
57:44 Constructors are called in order, but destructors are called in reverse order.
1:00:11 Destructor releases resources and has addition
Maza aa gaya Rohit Bhaiya
aaj constructor and destructor completely chamak gaya
Thanks a lot
Bhai kya tum Inka notes bnate ho?
sir is doing very hard work for us he woke up at 4 am to provide us video there is not enough word to thanks him❤❤ so everybody keep try to push✅
Day 100 Time Stamps :
0:00 Introduction
1:12 Constructors
4:45 Default Constructor
9:00 Parameterized Constructor
15:10 This Pointer
17:38 Constructor Implementation
25:57 Constructor Overloading
28:16 Inline Constructor
34:46 Copy Constructor
44:07 Value Assignment with Assignment Operator
44:50 Destructor
56:50 Constructor & Destructor Call Order
Thanks bhai
@@CoderArmy9 koi nhi bhaiya, thanks apko itna efforts dete ho aap video mei, apki videos pure gold hai beginners friendly ekdum
H/W: Why destructors are called in reverse Order ✅✅
This is because the objects are created in a Stack which follows the LIFO order, so when one object gets out of the stack, its destructor gets called. Also, the intuition behind this LIFO order is that, one object can be dependent of other object in case of copy constructor.
Eg: for Customer A4(A3), suppose A3 contains one dynamically allocated data, it means that A4 is dependent on A3.
Now, if A3 is destroyed first, then that heap memory is also going to be destroyed and A4 will not have any data to point to.
HW: Shallow Copy and Deep Copy ✅✅
Shallow Copy means copying the reference only, whereas deep copy means copying the value also and allocate a completely new memory.
Customer(string name, int bal){
this->name = name;
balance = new int;
*balance = bal; // Deep copy
balance = &bal; // Shallow copy
}
Thankyou bhaiya
For this kind of masterpiece content
I am learning from many places
But this is exceptional
Bhaiya you are one of the best teacher ..
Bhaiya ka Concept bhutt tagda clear hai tabhi Aaj hame itni asani se smjha pa rhe hai thanks a lot bhaiya aapse padh ke maja ayega pura samajh agaya😊
Bahut achha tarika hai padhane ka
Perfectly understood bhaiya!
Its just mind-blowing ❤
great teaching sir superb job
What a explanation, thanks you bhaiya .
Chamka gaya bhaiya 💪✅
Day 100/180 How's Josh? Soldiers!!
"OUR ARMY MUST WIN THE WAR AGAINST ENEMIES (Fear, Procrastination, Self Doubt, Comfort Zone)".
Thank You Rohit Bhaiya for guiding us and giving HOPE.🪔
Yes bro definitely we will win🔥
great sir chamak gya thankyou sir.
thanks sir your teaching is too good
Sir chamak gaya bohat achi tara❤
Constructor amd Destructor Chamak Gaya✅✅✅
chamak gaya bhaiya
Superb session 🔥
Thanks for helping me in programming (OPPs) ❤
rohit bhaiyya you are the best
Destruct ka actual kaam Aaj samajh aa gya bhaiya❤
Awesome session bhaiya OOPS ki concepts me maza aa gaya.
Bhai kya tum inka notes bnate ho?
Awesome lecture ❤❤❤❤❤
nice explanation bhaiya
Maja aagaya Bhaiya 👍🏻
Done Bhaiya... Day 100/180 ✅
Understood Sir ji❤🙇🙏
Thanks Bhaiya...❤🎉
Namaste bhaiya, kaise ho aap ? sab chamaka diya aapne bhaiya thanks bhaiya
THANK U BHAIYA ❤
Time stamps :
0:00 Introduction
1:18 Object-Oriented Programming (OOP)
13:36 OOP Implemention
17:40 Access Modifier
22:49 Class
23:52 Setter function
28:45 Getter Function
35:28 Object
43:26 Size of Class
44:05 Size of Object
45:59 Empty Class
47:45 Padding Concept
1:03:55 Dynamic Memory Allocation in OOP
Thanks bhai
bhai maja aa gayaa sab samjh me aa gya
Bhai kya tum inka notes bnate ho
Thank You Vhaiya
Very good
Bhaiya one day this channel will make Unicorn channel ❤❤❤❤
nice lecture
Day 100 👍✅ Chamak Gaya
Thank you so much sir
My 2nd sem started and I have Oops in C++, I searched alot and everywhere it's 1 or 2 hr oneshot were found...was really confused...Today while scrolling I found this amazing series with such detail .
Can't thank you enough bhaiya
Welcome , Kindly Update your marks also after result
great 💞
thankn you vaiya..
thank you so much bhaiya
Bhai bhai rohit bhai kya jabardast content h
Thanks
Nice Sir
Maxa agaya sir❤️
Chamka bhaiya 💝💝💝💝
Mera abhi morning hua or video bhi agaya😅. Anyway thank you Bhai.
Good Morning bhai❣
Noice Bhai 😀
Good morning sir ❤
maja aa gya sir ji
nice
thanks bhaiya
Good morning bhaiya
1:30 bhaiya started 💗
Radhe radhe
Sir supper🎉🎉🎉🎉🎉❤
Target doubled🎉
Ha ji bhaiya 😊
Destructors are called in reverse order because an object created later may use the previously created object.
As in the case of copy constructor, we are using previous object and copying it to the newly created object.
Hope it helps!
Chamak Gaya hai❤
supper sir
Bhaiya Radhe Radhe 🙏
Good Morning bhai❣
Good morning bhaiya ❤
Good Morning bhai❣
Bhaiya Thank You ♥️ aap daily time nikal kar lecture upload karte ho
Welcome bhai
bhaiya aapne jab kaha hum direct copy nahi kar sakte values fir aapne & use kiya, but agar direct krna ho to lya karna hoga.
if anyone knows pls let me know.
best
💥💥💥
Done😊
Good morning boss ❤
Good Morning bhai❣
Day 100 ✅🔥
Day 100/180 👍👍
free mai asa content kon deta hai love you
day 100 done
❤
Good Morning bhaiya ❤❤
Good Morning bhai❣
done
Good Morning, thoda Schedule Hectic ho rkha hai, Subha 4am video banaya hai, fr edit wgera hua, isly 7.30am tak video aaya hai, Baaki Time Stamp Add kar dena aap, it will help other also.
44
Reply
done ✅✅✅
Day 100/180 ✅
&hearts
Bhaiya aj late video aya bhaiya but thanks ❤❤
Good Morning bhai❣
@@CoderArmy9 Good morning 🌄 bahiya ♥️
Bhaiya OS , COA , DBMS and CN k liye prepartion RoadMap ya fir Courses Laoge kya
👍🏻😁
Bhaiya AJ late ai video bhaiya 🎉🎉 but it's ok
at 24:45 mystery revealed, my doubt cleared
good morning bhaiya
Good Morning bhai❣
Ha ji bhaiya Good Morning ❤
Good Morning bhai❣
Good morning bhaiya❤
Aaj late ho gaye
Good Morning bhai❣
understood everything to the point but at the end didn't got how "Destructor is 4" got printed with delete A4.
can anyone help please. what was the flow when delete A4 was executed?
Good morning ❤❤
Good Morning bhai❣
Bhaiya chamak chuka hain
#180
Keso ho bahiya
49:15