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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:10:37+00:00 2026-06-11T01:10:37+00:00

My question has changed from the other one I have posted. I started out

  • 0

My question has changed from the other one I have posted. I started out with multiple files and decided to put it all in one main.cpp file for now just to get it working.

main.cpp:

#include <iostream>
using namespace std;

class arrayListType {
    public:
        bool isEmpty() ;
        bool isFull() ;
        int listSize() ;
        int maxListSize() ;
        void print() ;
        bool isItemAtEqual(int location, int item) ;
        virtual void insertAt(int location, int insertItem) = 0;
        virtual void insertEnd(int insertItem) = 0;
        void removeAt(int location);
        void retrieveAt(int location, int& retItem) ;
        virtual void replaceAt(int location, int repItem) = 0;
        void clearList();
        virtual int seqSearch(int searchItem) const  = 0;
        virtual void remove(int removeItem) = 0;
        arrayListType (int size = 100);
        arrayListType ( arrayListType& otherList);
        virtual ~arrayListType();
    protected:
        int *list;
        int length;
        int maxSize;
};


bool arrayListType::isEmpty()  {
    return (length == 0);
}
bool arrayListType::isFull()  {
    return (length == maxSize);
}
int arrayListType::listSize()  {
    return length;
}
int arrayListType::maxListSize()  {
    return maxSize;
}
void arrayListType::print()  {
    for (int i = 0; i < length; i++)
        cout << list[i] << " ";
    cout << endl;
}
bool arrayListType::isItemAtEqual(int location, int item)  {
    if (location < 0 || location >= length) {
        cout << "The location of the item to be compared is out range." << endl;
        return false;
    }
    else
        return(list[location] == item);
}


void arrayListType::removeAt(int location) {
    if (location < 0 || location >= length){
        cout << "The location of the item to be removed is out of range." << endl;
    }
    else {
        for (int i = location; i < length -1; i++)
            list[i] = list[i+1];
        length--;
    }
}
void arrayListType::retrieveAt(int location, int& retItem)  {
    if (location < 0 || location >= length) {
        cout << "The location of the item to be retrieved is out of range." << endl;
    }
    else
        retItem = list[location];
}


void arrayListType::clearList() {
    length = 0;
}


arrayListType::arrayListType (int size) {
    if (size <= 0) {
        cout << "The array size must be positive. Creating an array of the size 100." << endl;
        maxSize = 100;
    }
    else
        maxSize = size;
    length = 0;
    list = new int[maxSize];
}

class orderedArrayListType: public arrayListType {

    public:
        void insertAt(int location, int insertItem);
        void insertEnd(int insertItem);
        void replaceAt(int location, int repItem);
        int seqSearch(int searchItem) const;
        void insert (int insertItem);
        void remove (int removeItem);
        orderedArrayListType (int size = 100);
        ~orderedArrayListType();
    private:
        void quickSort();
};



void orderedArrayListType::quickSort(){
//private function for sorting "list."
//using a "quicksort" method
//addapted from: http://www.algolist.net/Algorithms/Sorting/Quicksort
    if (length == 0) {
        cout << "Cannot sort an ampty list." << endl;
    }
    else {
        int left = 0, right = length;
        int i = left, j = right;
    int tmp;
    int pivot = list[(left + right) / 2];
    /* partition */
    while (i <= j) {
        while (list[i] < pivot)
            i++;
        while (list[j] > pivot)
            j--;
        if (i <= j) {
            tmp = list[i];
            list[i] = list[j];
            list[j] = tmp;
            i++;
            j--;
        }
    };
    /* recursion */
    if (left < j)
        quickSort();
    if (i < right)
        quickSort();
    }
}




void orderedArrayListType::insertAt(int location, int insertItem){

    if (location < 0 || location >= length){
        cout << "The location of the item to be removed "
        << "is out of range." << endl;
    }
    else if(length == maxSize){
        cout << "Cannot insert in a full list." << endl;
    }
    else {
        for (int j = length; j < location; j--){ 
            list[j+1] = list[j]; 
            /* 
            Start at the end of the array and move each item 
            out by one. Coninue until list[j] is at the 
            location, then set the list[location] to the value.
            */  
        }
        list[location] = insertItem;
        length++;
    }
    quickSort();
}

void orderedArrayListType::insertEnd(int insertItem) {

    if (length == maxSize){
        cout << "Cannot insert in a full list." << endl;
    }
    else {
        list[length] = insertItem;
        length++;
    }
    quickSort();
}


void orderedArrayListType::replaceAt(int location, int repItem) {
    if (location < 0 || location >= length){
        cout << "The location of the item to be replaced "
        << "is out of range." << endl;
    }
    else
        list[location] = repItem;
    quickSort();
}

int orderedArrayListType::seqSearch(int searchItem) const {

    int loc;
    bool found = false;
    loc = 0;
    while (loc < length && !found) {
        if (list[loc] == searchItem)
            found = true;
        else
            loc++;
    }
    if (found)
        return loc;
    else
        return -1;
}


void orderedArrayListType::insert (int insertItem){
    if (length == 0){
        list[length++] = insertItem;
    }
    else if (length == maxSize){
        cout << "Cannot insert in a full list." << endl;
    }
    else {
        int loc;
        bool found = false;
        for (loc= 0; loc < length; loc++){
            if (list[loc] >= insertItem){
                found = true;
                break;
            }
        }
        for (int i = length; i > loc; i--) {
            list[i] = list[i-1];
        }
        list[loc] = insertItem;
        length++;
    }
    quickSort();
}
void orderedArrayListType::remove (int removeItem) {

    int loc;

    if (length == 0)
        cout << "Cannot Delete from an ampty list." << endl;
    else {
        loc = seqSearch(removeItem);
        if (loc != -1)
            removeAt(loc);
        else
            cout << "The item to be deleted is not in the list." << endl;
    }
}


orderedArrayListType::orderedArrayListType (int size)
    :arrayListType(size){
}





int main() {

//  orderedArrayList intlist(25);
//  orderedArrayListType intList = new orderedArrayListType(25);
}

The exact error message:

/tmp/ccdTFaE0.o: In function arrayListType::arrayListType(int)':
main3.cpp:(.text+0x25c): undefined reference to
vtable for
arrayListType’
/tmp/ccdTFaE0.o:(.rodata._ZTV20orderedArrayListType[vtable for
orderedArrayListType]+0
x38): undefined reference to
orderedArrayListType::~orderedArrayListType()'
/tmp/ccdTFaE0.o:(.rodata._ZTV20orderedArrayListType[vtable for
orderedArrayListType]+0
x40): undefined reference to
orderedArrayListType::~orderedArrayListType()’
/tmp/ccdTFaE0.o:(.rodata._ZTI20orderedArrayListType[typeinfo for
orderedArrayListType]
+0x10): undefined reference to `typeinfo for arrayListType’ collect2: ld returned 1 exit status

tldr;

#include <iostream>
using namespace std;

class arrayListType {
    public:
        bool isEmpty() const;
                ...
                arrayListType (int size = 100);
        arrayListType ( arrayListType& otherList);
        virtual ~arrayListType();
    protected:
        int *list;
        int length;
        int maxSize;
};


//definitions 
bool arrayListType::isEmpty()  {
    return (length == 0);
}

class orderedArrayListType: public arrayListType {

    public:
        void insertAt(int location, int insertItem);
        ...
        orderedArrayListType (int size = 100);
        ~orderedArrayListType();
    private:
        void quickSort();
};



void orderedArrayListType::quickSort(){
 ...
 }




void orderedArrayListType::insertAt(int location, int insertItem){

       ....     

    quickSort();
}

   orderedArrayListType::orderedArrayListType (int size)
    :arrayListType(size){
}


int main() {

    orderedArrayList intlist(25);
//  orderedArrayListType intList = new orderedArrayListType(25);
}
  • 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-11T01:10:39+00:00Added an answer on June 11, 2026 at 1:10 am

    What compiler are you using? Visual Studio 2010 gives this more helpful output:

    1>cachesize.obj : error LNK2019: unresolved external symbol “public: virtual __thiscall arrayListType::~arrayListType(void)” (??1arrayListType@@UAE@XZ) referenced in function “public: virtual void * __thiscall arrayListType::`scalar deleting destructor'(unsigned int)” (??_GarrayListType@@UAEPAXI@Z)

    1>cachesize.obj : error LNK2019: unresolved external symbol “public: virtual __thiscall orderedArrayListType::~orderedArrayListType(void)” (??1orderedArrayListType@@UAE@XZ) referenced in function “public: virtual void * __thiscall orderedArrayListType::`scalar deleting destructor'(unsigned int)” (??_GorderedArrayListType@@UAEPAXI@Z)
    1>C:\Users\james\Documents\Visual Studio 2010\Projects\cachesize\Debug\cachesize.exe : fatal error LNK1120: 2 unresolved externals

    You need to add bodies to virtual ~arrayListType(); and ~orderedArrayListType();.
    You’ve declared them but not defined them. It compiles then!

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

Sidebar

Related Questions

I have already posted a question about this, but the situation has changed sufficiently
UPDATE: Facebook's API has changed a lot since this question was posted. This question
I have a repo that has two files that supposedly I changed locally. So
I have two classes, one has a lot of properties and the other has
Ok my orignal question has changed. How do i change the intensity of how
I deleted my prior question dealing with the subject as the context has changed
This is a spin off from another question I posted a few days ago
This question has developed off an answer here . My question therefore is what
This question has two parts. Part 1. Yesterday I had some code which would
My question has two parts: Is it possible that, if a segfault occurs after

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.