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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:32:01+00:00 2026-05-31T15:32:01+00:00

I can understand that there might be a reason to declare an implemented (as

  • 0

I can understand that there might be a reason to declare an implemented (as opposed to pure) virtual function private or protected. Afaik, if you declare an implemented virtual method as protected, your child class can call the base class’s method (and nobody else can). If you declare it private, than only the base class can call the default implementation of the virtual method.

However, with pure virtuals, there is no base implementation… So isn’t it functionally equivalent to declare a pure virtual as either private or protected? A protected pure virtual doesn’t make sense because you can’t ever invoke the base class’s corresponding method. Are there any scenarios where a protected pure virtual makes any sense?

There are a few similar topics on SO, but I couldn’t find anything that concisely answered my question.

  • 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-31T15:32:02+00:00Added an answer on May 31, 2026 at 3:32 pm

    Are there any scenarios where a protected pure virtual makes any
    sense?

    I think that you mean private here (instead of protected), but think I understand your point. In fact, the access type of a pure virtual can be overridden in derived classes. Here’s an example that might help you see the difference between a private and protected pure virtual:

    class Parent
    {
      protected: virtual void foo() = 0;
      private:   virtual void bar() = 0;
      public:            void test() { foo(); bar(); }
    };
    
    class Child : public Parent
    {
      public: void test2() { foo(); /* bar(); // cannot be called here */ }
    };
    
    class GrandChild : public Child
    {
      // access types here can be anything for this example
      public: void foo() { cout << "foo" << endl; }
      public: void bar() { cout << "bar" << endl; }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ignoring the IE case, are there any other browsers that can't understand the application/xhtml+xml
Is there a way that I can configure Visual Studio 2008 to understand CamelCase?
In the program below, there are two things that I don't understand. How can
I can understand that imposing a minimum length on passwords makes a lot of
OK so now I can understand that SO's search system is primarily based around
what is the need for a read shared lock? I can understand that write
![enter image description here][1]On my two demo and screenshot, you can understand that so
Any existing Flash SWF compilers that can understand directives like #IF #ENDIF , etc?
I understand that I can specify system properties to Tomcat by passing arguments with
I understand that you can now create MVC-specific user controls, but will my existing

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.