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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:50:04+00:00 2026-05-23T10:50:04+00:00

I am using an abstract class SetOfInt ; where a Btree baseclass inherits from.

  • 0

I am using an abstract class SetOfInt; where a Btree baseclass inherits from. The declaration of the virtual function find gives me a compiler error and I cannot figure out why?

This is the exact error:

SetOfInt.h:21: error: expected unqualified-id before 'virtual'
SetOfInt.h:21: error: abstract declarator 'Node*' used as declaration
SetOfInt.h:21: error: expected ';' before 'virtual'
SetOfInt.h:30: error: expected unqualified-id before 'virtual'
SetOfInt.h:30: error: abstract declarator 'Node*' used as declaration
SetOfInt.h:30: error: expected ';' before 'virtual'

Any help would be highly appreciated!

/*  1 */ #include <cstdlib>
/*  2 */ #include <iostream>
/*  3 */
/*  4 */ using namespace std;
/*  5 */
/*  6 */ class Node
/*  7 */ {
/*  8 */ public:
/*  9 */     Node (int x);
/* 10 */     int m_data;
/* 11 */     Node *m_left;
/* 12 */     Node *m_right;
/* 13 */ };
/* 14 */
/* 15 */ class SetOfInt
/* 16 */ {
/* 17 */ public:
/* 18 */     void virtual add(int x)=0;
/* 19 */     bool virtual test(int x)=0;
/* 20 */     bool virtual remove(int x)=0;
/* 21 */     Node* virtual find(int x)=0;
/* 22 */ };
/* 23 */
/* 24 */ class Btree : public SetOfInt
/* 25 */ {
/* 26 */ public:
/* 27 */     void virtual add(int x);
/* 28 */     bool virtual test(int x);
/* 29 */     bool virtual remove(int x);
/* 30 */     Node* virtual find(int x);
/* 31 */     Node *m_root;
/* 32 */ };
  • 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-23T10:50:04+00:00Added an answer on May 23, 2026 at 10:50 am

    The return types should go after the virtual keyword.

    i.e.

    virtual void add(int x);
    

    instead of

    void virtual add(int x);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have abstract class: #include <string> using namespace std; class AString { public: virtual
How can I test a private method of an abstract class using reflection (using
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace EfTestFactory { public abstract class
I'm trying to implement an identity map using generics. I have an abstract class,
I have a very simple scenario, using NHibernate: one abstract base class animal; two
I implemented the Strategy design pattern using an Abstract template class, and two subclasses.
In an abstract class ( C# 3 ), there is a virtual method named
I'm not familiar on using abstract class . I'm trying to call a abstract
I am using an abstract class std::ostream. There is the following reference: std::ostream &o
I'm using a Compatibility class to build a User Agent string: public abstract class

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.