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 711259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:42:54+00:00 2026-05-14T04:42:54+00:00

I recently came to know that in C++ pure virtual functions can optionally have

  • 0

I recently came to know that in C++ pure virtual functions can optionally have a body.

What are the real-world use cases for such functions?

  • 1 1 Answer
  • 1 View
  • 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-05-14T04:42:54+00:00Added an answer on May 14, 2026 at 4:42 am

    The classic is a pure virtual destructor:

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

    You make it pure because there’s nothing else to make so, and you want the class to be abstract, but you have to provide an implementation nevertheless, because the derived classes’ destructors call yours explicitly. Yeah, I know, a pretty silly textbook example, but as such it’s a classic. It must have been in the first edition of The C++ Programming Language.

    Anyway, I can’t remember ever really needing the ability to implement a pure virtual function. To me it seems the only reason this feature is there is because it would have had to be explicitly disallowed and Stroustrup didn’t see a reason for that.

    If you ever feel you need this feature, you’re probably on the wrong track with your design.

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

Sidebar

Related Questions

i recently came to know that groovy++ have been released, what is the major
Recently I came to know about graph databases.I read that these databases have limited
I recently came to know that, different Information Technology are also based on N-Tier
I recently came across classes that use a configuration object instead of the usual
I recently came across some functions where you can pass multiple enums like this:
Associative arrays are usually implemented with Hashtables. But recently, I came to know that
I recently came across a big problem, as I have a system that's paying
Recently I have purchased a notebook that came with Windows Home Basic (that don't
I recently came across Flex builder and it was gr8 to know that it
It recently came to my attention that member functions completely shadow free functions with

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.