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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:46:50+00:00 2026-06-12T15:46:50+00:00

I have 4 C++ files, 2 headers, and 2 .cc files. This is just

  • 0

I have 4 C++ files, 2 headers, and 2 .cc files. This is just a proof of concept but I can’t seem to get it right.

My first header looks like this:

#ifndef INT_LIST_H
#define INT_LIST_H
class IntList
{
  public:

     //Adds item to the end of the list
     virtual void pushBack(int item) = 0;
};
#endif

My second header uses the first and looks like this:

#ifndef ArrayIntList_H
#define ArrayIntList_H
#include "IntList.h"


class ArrayIntList : public IntList
{
    private:
        int* arrayList;
        int* arrayLength;

     public:
        //Initializes the list with the given capacity and length 0
        ArrayIntList(int capacity);

        //Adds item to the end of the list
        virtual void pushBack(int item) = 0;

};
#endif  

my first .cc file fills in the methods of the previous class:

#include <iostream>
#include "ArrayIntList.h"

ArrayIntList::ArrayIntList(int capacity)
{
    //make an array on the heap with size capacity
    arrayList = new int[capacity];
    //and length 0
    arrayLength = 0; 
}

void ArrayIntList::pushBack(int item)
{
    arrayList[*arrayLength] = item;
}

And this is my main function:

#include <iostream>
#include "ArrayIntList.h"

int main(int argc, const char * argv[])
{
    ArrayIntList s(5);
}

When I run this in Xcode I get an error that “Variable ArrayIntList is an abstract class”
I don’t understand how this can be since I defined it in my above .cc file. Any ideas?

  • 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-12T15:46:51+00:00Added an answer on June 12, 2026 at 3:46 pm

    On class ArrayIntList use this

    virtual void pushBack(int item);
    

    instead of this

    virtual void pushBack(int item) = 0;
    

    The reason is that when you assign a 0 to a function declaration, you are saying it is “pure”, or not implemented. But you are doing that (implementing it) below.

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

Sidebar

Related Questions

I'm not totally sure but this looks wrong: I have a header file named
I have been seeing code like this usually in the start of header files:
I have this problem that I can't seem to find a solution for... I
So this should be pretty easy, yet I can't get it work. I have
I have this header file, zeeheader.h, and I wrote some classes in it, I'm
I have a header file. In this header I want to use a map
I have a header file like this: #ifndef __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #define __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #ifdef _DEBUG //
I have a macro definition in header file like this: // header.h ARRAY_SZ(a) =
I have registered an enumeration type ClefType within my header file - this enum
I have .lib file with its header (.h) file. This file have a few

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.