Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Pure virtual destructor ?

Pure virtual destructor ?

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    krishna_CP
    wrote on last edited by
    #1

    HI, What is pure virtual destructor? what is the use of using pure virtual destructor ? Thanks, Krish.

    CPalliniC C A 3 Replies Last reply
    0
    • K krishna_CP

      HI, What is pure virtual destructor? what is the use of using pure virtual destructor ? Thanks, Krish.

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      See, for instance, the competitors...[^]. Personally, I think you should always use virtual destructors. No need to have pure virtual destructors (see [^]).

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      1 Reply Last reply
      0
      • K krishna_CP

        HI, What is pure virtual destructor? what is the use of using pure virtual destructor ? Thanks, Krish.

        C Offline
        C Offline
        Chris Losinger
        wrote on last edited by
        #3

        LMGTFY[^]

        image processing toolkits | batch image processing

        1 Reply Last reply
        0
        • K krishna_CP

          HI, What is pure virtual destructor? what is the use of using pure virtual destructor ? Thanks, Krish.

          A Offline
          A Offline
          Aescleal
          wrote on last edited by
          #4

          A pure virtual destructor is any destructor marked as virtual with = 0 after it's signature, e.g:

          class T
          {
          public:
          virtual ~T() = 0;
          };

          Making a destructor pure virtual means very little more than making the destructor virtual (and you do that to make sure the correct destructor is called when you delete an object through a base class pointer). The additional bit is that it means the derived class has to define it's own destructor and not rely on the base class one. One additional wrinkle is that all pure virtual destructors have to have an implementation, unlike normal pure virtual member functions which don't have to have one. Cheers, Ash

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups