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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:32:29+00:00 2026-05-10T14:32:29+00:00

Is anyone aware of a language feature or technique in C++ to prevent a

  • 0

Is anyone aware of a language feature or technique in C++ to prevent a child class from over riding a particular method in the parent class?

class Base { public:     bool someGuaranteedResult() { return true; } };  class Child : public Base { public:     bool someGuaranteedResult() { return false; /* Haha I broke things! */ } }; 

Even though it’s not virtual, this is still allowed (at least in the Metrowerks compiler I’m using), all you get is a compile time warning about hiding non-virtual inherited function X.

  • 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. 2026-05-10T14:32:29+00:00Added an answer on May 10, 2026 at 2:32 pm

    A couple of ideas:

    1. Make your function private.
    2. Do not make your function virtual. This doesn’t actually prevent the function from being shadowed by another definition though.

    Other than that, I’m not aware of a language feature that will lock away your function in such a way which prevents it from being overloaded and still able to be invoked through a pointer/reference to the child class.

    Good luck!

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

Sidebar

Related Questions

Is anyone aware of a method to export specific fields from a database with
Apart from lxml , is anyone aware of Python packages that depend on libxml2
Does anyone aware of C# API to accept Language-Culture and return corresponding Code Page?
I'm wondering if anyone if aware of a language that has support for variables
Is anyone aware of a decent CSV export tool for exporting from a ListView?
Is anyone aware of a quick way of reading in an xml file over
Is anyone aware of any method (or external plugin) that would allow for nested
Are anyone aware of any method to achieve indentation in the ASPXGridView (we are
Is anyone aware of a pure, Javascript based implementation of the directional flow diagrams
Is anyone aware of a practical (real-life) use of Ruby's DBM lib? Is it

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.