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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:32:27+00:00 2026-06-08T13:32:27+00:00

class A { public: A(…) {…} virtual ~A() {…} private: // may contains data

  • 0
class A
{
public:
    A(…) {…}
    virtual ~A() {…}
    
private:
    // may contains data
};

class B : public A
{
public:
    B(…) {…}
private:
    // contains no data
};

class C : public B
{
public:
    C(…) {…}
    ~C() {…}
private:
    // may contains data
};

As you can see, class A is the base class so we have to provide a implemented virtual destructor.

Question> Do we have to provide a default destructor for a concrete class B?
class B itself doesn’t require to implement a customized destructor to release any allocated resource.

Thank you

  • 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-08T13:32:31+00:00Added an answer on June 8, 2026 at 1:32 pm

    No. Once one base destructor is virtual, all derived destructors are automatically virtual. If the default implementation suffices, you do not need to provide a user-defined destructor.

    (In fact, if the default implementation suffices even in the base, you should declare and define it as virtual ~A() = default;, rather than with an empty body.)

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

Sidebar

Related Questions

I have a base class: class motorcycle { public: virtual int speed() { return
I have a class: public class User { public virtual int Id { get;
I have my class X : public class ClassX { public virtual IList<ClassY> ListY
A very simple base class: class Figure { public virtual void Draw() { Console.WriteLine(Drawing
So, I have a base class which has a private locking object like so:
In C++, you can do the following: class base_class { public: virtual void do_something()
foo.h #include "class1.h" class foo{ private: class1* class1ObjectPointer; public: foo(); virtual ~foo(); void foomethod();
May be a simple question.. I have an interface: public interface ISanitizer { T
I have the following code: #include <iostream> class Grandma { public: virtual void foo()
I have following class public class Value { ... public virtual Unit Unit {

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.