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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:59:13+00:00 2026-05-15T07:59:13+00:00

When creating prototype classes I lay out the destructor as such: virtual ~MyClass(); When

  • 0

When creating prototype classes I lay out the destructor as such:

virtual ~MyClass();

When finalizing the class in a library I noticed that I cannot add ‘virtual’. Is this normal, and is virtual taken into consideration or am I do something wrong?

For example; when I try to do this I get a compiler error:

virtual MyClass::~MyClass() { }

Instead doing this works:

MyClass::~MyClass() { }

My question is since I do not have to include virtual in the final code write of the destructor does the destructor still behave as a virtual destructor (since it is virtual as a prototype)?

  • 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-05-15T07:59:14+00:00Added an answer on May 15, 2026 at 7:59 am

    The virtual keyword is only used as part of the member function declaration inside of the class definition.

    If the member function is defined outside of the class definition, the virtual keyword is not placed there.

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

Sidebar

Related Questions

I'm creating a JavaScript class (using Prototype) that will set the page state to
We have a set of classes created that depend on Prototype's Class implementation (and
I'm creating a prototype of a CSS/XHTML tables-based calendar that eventually will be generated
Possible Duplicate: JavaScript: Class.method vs. Class.prototype.method What's the difference between creating a prototype like
I'm creating my first rails app, and using the standard prototype library for some
Greetings! I'm creating a web form prototype (ImageLaoder.aspx) that will return an image so
I'm creating a prototype for a piece of functionality that I will be implementing
I am confused with hundreds of ways of creating JS classes. One says that
I'm creating a game engine, or more like a large library of useful classes
I have a method that will let me select the prototype object when creating

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.