Destructor In C++

Sdílet
Vložit
  • čas přidán 13. 09. 2024

Komentáře • 41

  • @ApoorvSaxena8
    @ApoorvSaxena8 Před 3 lety +1

    thanks for the video sir

  • @meeturadi
    @meeturadi Před 4 lety +1

    Hello Sir
    Could you please provide the link for Pointer Data Members In C++

  • @suyashwagh831
    @suyashwagh831 Před 6 lety +2

    Sir please upload videos for Standard template library

    • @CppNuts
      @CppNuts  Před 6 lety

      Suyash, coming soon!!

  • @Abhiraj91197
    @Abhiraj91197 Před 5 lety +2

    why do we need to call explicitly call destructor if delete operator will delete the assigned memory and any way delete is going to call destructor then ???

    • @CppNuts
      @CppNuts  Před 5 lety

      There is something called placement new there we need to call destructor explicitly. I have video for that please check.

  • @ramachandrayenda8152
    @ramachandrayenda8152 Před rokem

    thanks sir

  • @khushijain4969
    @khushijain4969 Před 5 lety +2

    Your videos are helpful , thanks :-)

  • @khalidtech7770
    @khalidtech7770 Před 3 lety

    You are good thnks

  • @praveenchaubey7018
    @praveenchaubey7018 Před 4 lety +1

    Hey, my code is similar to your code but i am getting destructor printed three times. Here is my code
    #include
    using namespace std;
    class Base{
    int *x;
    public:
    Base(){cout

    • @Shubham-ho3nl
      @Shubham-ho3nl Před 3 lety

      It it because you are creating 2 different objects i.e. b and b1. Compiler will call the distructuctor for b, b1 and ofcourse your explicit call of distructor.
      Hope i have solved ur doubt.

  • @narendrachordiya2563
    @narendrachordiya2563 Před 3 lety

    Hello sir, could you please share the pointer data member link, I am not able to find it.

  • @nithyanarayan8080
    @nithyanarayan8080 Před 5 lety +1

    so the compiler defined Destructor will not delete the memory allocated by new operator?

    • @CppNuts
      @CppNuts  Před 5 lety +1

      Exactly!!
      That is the reason we give our own Destructor.

  • @Manishkumar-ie2oo
    @Manishkumar-ie2oo Před 5 lety +1

    Sir do you use bracket editor.

    • @CppNuts
      @CppNuts  Před 5 lety

      No.. i use Sublime text editor 3.

  • @gkv-bj2mj
    @gkv-bj2mj Před 4 lety

    What Could be best book as You learn from you c++ , as You clear concept.

    • @CppNuts
      @CppNuts  Před 4 lety +1

      My learning comes from stack overflow website. I used to give answers for the questions and read others answer. As you know there is no direct source of learning so deeply.

  • @techytechwithgunjan9175
    @techytechwithgunjan9175 Před 6 lety +1

    sir i didnt find the video-> Pointer Data Members In C++

  • @bensalemmohamedabderrahman5844

    whats the meaning of adding : after declaring the parameters of a function

  • @faranahmadk7401
    @faranahmadk7401 Před 3 lety

    thanks man.

  • @poovendhans1557
    @poovendhans1557 Před 4 lety

    Destrcutor will destroy all the objects and data members which is created for Class if my understanfing is correct. isn't it?

    • @CppNuts
      @CppNuts  Před 4 lety +1

      Yes

    • @UvUtkarsh
      @UvUtkarsh Před 3 lety +1

      This is correct but
      Consider a situation like that in this video destructor doesn't delete (or free) the memory pointed by the pointer so when the destructor is called the pointer is deleted but the memory to which it is pointing to still remains there (because that memory is not the part of the object.).
      Now you can't access that memory, which results in the memory leak. This is why destructors are needed.

    • @khalidtech7770
      @khalidtech7770 Před 3 lety

      @@UvUtkarsh mean it clears the memory address

    • @SunnyKumar-hp9tx
      @SunnyKumar-hp9tx Před 3 lety

      @@khalidtech7770 Yes, dangling pointer would be there.

  • @saravananjagadeeesan593

    Sir in the parameterized constructor , what does " x{a} { } " mean . Have you mentioned this syntax in any of u r videos ??

    • @SunnyKumar-hp9tx
      @SunnyKumar-hp9tx Před 3 lety +1

      That is called initializer list, where we initialize the data members not assigned the values to data members..if you are aware of const data member then you can relate it very well.

  • @bbdnuh1028
    @bbdnuh1028 Před 6 lety +1

    Holy fk nice

  • @gamerzheaven6067
    @gamerzheaven6067 Před 5 lety +1

    that annoying sound of clicking :D

    • @CppNuts
      @CppNuts  Před 5 lety +1

      Sorry now i have cleared almost all the issues from my recording setup. :D