Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8680005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:08:17+00:00 2026-06-12T21:08:17+00:00

Scott said on Effective C++, 3rd Edition, pg. 43 that to make an abstract

  • 0

Scott said on Effective C++, 3rd Edition, pg. 43 that to make an abstract class, we just need to give it a pure virtual destructor:

class AWOV {                  // AWOV = "Abstract w/o Virtuals"
public:
  virtual ~AWOV() = 0;        // declare pure virtual destructor
};

Then, he went on said that there is one twist: we must provide a definition for the pure virtual destructor:

AWOV::~AWOW() {}              // definition of pure virtual dtor

My question is, by specifiying = 0, for pure virtual functions, we are saying that the function cannot have any definition for the class where this pure virtual function is declared.

Why is it OK to provide a definition (even it is empty) for the pure virtual destructor here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T21:08:18+00:00Added an answer on June 12, 2026 at 9:08 pm

    “we are saying that the function cannot have any definition for the class where this pure virtual function is declared.”

    That’s not what pure virtual means. Pure virtual only means that the containing class cannot be instantiated (is abstract), so it has to be subclassed, and subclasses must override the method. E.g.,

    struct A {
        virtual ~A() = 0;
    };
    
    A::~A() {}
    
    struct B : A {};
    
    int main()
    {
        A a;  // error
        B b;  // ok
    }
    

    Here, the B destructor is implicitly defined. If it was another method that is pure virtual, you’d have to explicitly override it:

    struct A {
        virtual void foo() = 0;
    };
    
    void A::foo() {}
    
    struct B : A {};
    
    int main()
    {
        B b;  // error
    }
    

    Providing a definition for a pure virtual method is desirable when the base class must be abstract but still provide some default behavior.

    In the specific case of a destructor, it has to be provided because it will be called automatically when subclass instances are destroyed. A program that tries to instantiate a subclass of a class with a pure virtual destructor without a definition will not pass the linker.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Scott Meyers's Effective C++ , item 18 Make interfaces easy to use correctly
This is from the item 16 of effective C++ 2nd edition scott meyers (page
Scott Guthrie just blogged about the new jQuery Templates that his team has been
I was just watching Scott Hanselman's presentation on ASP.NET MVC in San Francisco. After
In the lecture about universal references , Scott Meyers (at approximately 40th minute) said
Scott Chacon's Showoff gem is a great alternative to Powerpoint/Keynote... but the fact that
I am trying to use the Scott Allen's ChartBuilder class, but I can't find
I was listening to the podcast about PowerShell 2.0 that Scott Hanselman did .
Excuse my ignorance. I just saw Scott Hanselman's video on MVC 3 where he
Scott Meyers in Effective C++ points at the ability to do e.g. matrix operations

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.