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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:43:29+00:00 2026-06-10T09:43:29+00:00

Kind of a noob doubt here (another one from me :P ) Regarding a

  • 0

Kind of a noob doubt here (another one from me 😛 )

Regarding a book I’m reading:

  • One Abstract Base-Class(ABC) is so by the declaration of a pure virtual method.
  • What makes a method a pure virtual method is the = 0 at the end of the declaration.
  • You can declare one as this: virtual void f() = 0; This way you don’t need to define it in the ABC, but it’s mandatory for the derived classes to implement its own versions of it.
  • But you can also declare a virtual method like this: void f() = 0; This way you’d need to define the method in the ABC, and the derived classes could use it like that. This approach is needed for ABCs whose methods are all commonly applied by its derived classes.

If all the points above are true, what I don’t understand is: What is exactly a virtual method?

Because void f() = 0; looks like a regular method to me. The ABC would define it, and the derived objects would use the ABC’s definition, just like any other public method. Is there a definition of virtual method that is compelling for these two instances?

A pure virtual function or pure virtual method is a virtual function
that is required to be implemented by a derived class that is not
abstract

This definition is picked from another question from this site. So my guess is the book I’m reading is wrong? void f() = 0; states the class is an ABC but it’s not a pure virtual method. Could somebody confirm this or explain it to me?

  • 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-10T09:43:31+00:00Added an answer on June 10, 2026 at 9:43 am
    void f() = 0;
    

    Is wrong unless a base class defines f() as virtual. For example:

    class A
    {
    public:
       virtual void f() = 0;
    };
    
    class B : A
    {
       void f() = 0;
    }
    

    The above is legal because f() is inherently virtual. Otherwise, no.

    tl;dr you can’t declare a non-virtual method as pure, but a method can be virtual without explicitly specifying the virtual keyword (via inheritance). I hope this is what the book is talking about, otherwise I’m inclined to say it’s a crappy bad book.

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

Sidebar

Related Questions

One noob question. I often see those kind of things: public Constructor(Game game, string
I'm kind of a noob when it comes to windows API. I try to
I'm kind of a noob in jquery, so i'm sorry if the question is
Kind of a ruby-noob active record query question: Magazine has_many :subscriptions User has_many :subscriptions
I'm a noob in python. I'm kind of confused about how the python unit
Kind of a follow up to a question from yesterday. I have a hash
I'm kind of a noob in the android world, and doing a pet project
I think it's kind of noob question but I'm new to SQL Server in
Question: Hello All, Sorry that this is kind of a noob question. I just
Not sure how noob or advanced this question is, but I've been having kind

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.