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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:30:53+00:00 2026-05-26T11:30:53+00:00

As a requirement of an assignment for a data structures class, I have to

  • 0

As a requirement of an assignment for a data structures class, I have to get the following class hierarchy to work: http://www.brpreiss.com/books/opus4/

The source code is also provided, and right now I am simply trying to get stuff to compile. This has required re-organizing class definitions into their respective header files, moving template implementation into .inc files, and finishing bits of code which were not implemented. I have been making progress, but I am stuck on the following error (compiled with VC++):

1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall Iterator::~Iterator(void)" (??1Iterator@@UAE@XZ) referenced in function "public: virtual __thiscall NullIterator::~NullIterator(void)" (??1NullIterator@@UAE@XZ)

I have tried all of the usual solutions (eliminating redundant include statements, cleaning the project and recompiling, etc.) and am not sure where to go. As was previously discussed, the consensus here seems to be that this code-base is really poorly designed. Nonetheless, the requirement of this assignment is to get this code working, and I am into deep to scrap it all together and start from scratch. If it

Here is the iterator class definition in iterator.h

#ifndef ITERATOR_H
#define ITERATOR_H

#include "object.h"

class Iterator
{
public:

    virtual ~Iterator ();
    virtual void Reset () = 0;
    virtual bool IsDone () const = 0;
    virtual Object& operator * () const = 0;
    virtual void operator ++ () = 0;
};

class NullIterator : public Iterator
{
public:

    NullIterator () {}
    void Reset () {}
    bool IsDone () const { return true; }
    Object& operator * () const { return NullObject::Instance(); }
    void operator ++ () {}
};

#endif

These are all of the other header files which are associated with iterator:

#ifndef CONTAINER_H
#define CONTAINER_H

#include "object.h"
#include "visitor.h"
#include "iterator.h"
#include "ownership.h"

class Container : public virtual Object, public virtual Ownership
{
protected:

    unsigned int count;
    Container () : count(0) {}

public:

    virtual unsigned int Count () const { return count; }
    virtual bool IsEmpty () const { return Count () == 0; }
    virtual bool IsFull () const { return false; }
    //virtual HashValue Hash () const;
    virtual void Put (ostream&) const;
    virtual Iterator& NewIterator () const { return *new NullIterator (); }

    virtual void Purge () = 0;
    virtual void Accept (Visitor&) const = 0;
};

#endif

Stack and Queue also inherit from Container, but it appears only stack makes use of Iterator:

#ifndef STACK_H
#define STACK_H

#include "linkList.h"
#include "container.h"

class Stack : public virtual Container
{
public:

    virtual Object& Top () const = 0;
    virtual void Push (Object&) = 0;
    virtual Object& Pop () = 0;
};

class StackAsLinkedList : public Stack
{
    LinkedList<Object*> list;

    class Iter;

public:

    StackAsLinkedList () : list() {}
    ~StackAsLinkedList() { Purge(); }

    //
    // Push, Pop and Top
    //
    void Push(Object& object);
    Object& Pop() override;
    Object& Top() const override;

    int CompareTo(Object const& obj) const;

    //
    // purge elements from, and accept elements onto, the list
    //
    void Purge();
    void Accept (Visitor&) const;

    friend class Iter;
};

class StackAsLinkedList::Iter : public Iterator
{
    StackAsLinkedList const& stack;
    ListElement<Object*> const* position;

public:

    Iter (StackAsLinkedList const& _stack) : stack(_stack) { Reset(); }

    //
    // determine whether iterator is pointing at null
    //
    bool IsDone() const { return position == 0; }

    //
    // overloaded dereference and increment operator
    //
    Object& operator*() const;
    void   operator++();

    void Reset() { position = stack.list.Head(); }
};

#endif

If anyone has some insight, it would be much appreciated. I have been trying to solve this one error for the last few hours and haven’t made any progress!

  • 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-26T11:30:54+00:00Added an answer on May 26, 2026 at 11:30 am

    The error is a linking error which tells you that you have not provided a definition for the destructor:

    virtual ~Iterator();
    

    Which is being called through:

    NullIterator::~NullIterator(void)
    

    because NullIterator derives from Iterator class.

    Solution is You should provide the definition for the Base class destructor.

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

Sidebar

Related Questions

I have the following assignment for homework. Requirements Design a class called TokenGiver with
For a programming assignment, we have the following requirements: It needs to be a
[Assignment] Requirement Use specifically OutputStream subclasses to output data to a .txt file, that
I have a string property that has a maximum length requirement because the data
I have a class assignment where I have to write a program that will
I have an assignment due in my intro database class - and I'm stumped
I have a university assignment with a very peculiar requirement. The crux of it
I have an issue with meeting XHTML Strict requirements for a class assignment. The
I have an assignment for a business which is basically just about extracting data
I have the requirement of generating UML Diagrams for one of my C++ assignments.

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.