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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:40:46+00:00 2026-06-07T08:40:46+00:00

This is basically a best practice question, and a question about the intended usage

  • 0

This is basically a best practice question, and a question about the intended usage of override:

struct A
{
    virtual void func();
};

struct B : public A
{
    virtual void func() override;
};

In the above case it seems totally reasonable to use override. It tells the user of B that func overrides a virtual function from A (information that could only be conveyed with a comment pre-C++11). But what about when the user isn’t supposed to perceive that A is a base class… like if A is privately inherited:

struct B : private A
{
    virtual void func() override;
};

In this case I’m telling the user of B about an internal implementation detail they shouldn’t know exists. If the purpose of override is to give the writer of B an error if he didn’t actually override anything, that’s fine; But if the purpose is to convey more information to the user, should I not write override in this case?

  • 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-07T08:40:49+00:00Added an answer on June 7, 2026 at 8:40 am

    “override” is simply there so the implementor of a class can say “this method is supposed to override one from my base classes”. If he does, then the compiler will provide an error if the method does not actually override a base class method — which can happen if you mistype the name, or the base class changes later.

    EDIT: Thus, it’s a tool that helps with writing correct code; it’s not meant to be a documentation keyword of some kind.

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

Sidebar

Related Questions

This is a fairly straightforward question, I'm basically looking for a 'best practice' approach
This is basically a 'best practices' question. Struts 1 forms have getters and setters
What's the best practice to do this? Basically I am using rabbitMQ and it
this is more of a 'best practice' question than an actual problem: I'm working
So I'm not sure what the best way to accomplish this is, but basically
This is basically a duplicate of this question , but the accepted answer was
This is basically the same question as Click items in select box, and then
This is basically a rails 3 version of this question . Short of parsing
My question is around the best practice for dividing up an asp.net mvc web
Just a question about best-practices when upgrading an existing database. Assuming there will be

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.