I'm trying to Implement a LinkedSet and will then read in files to make a function that spell checks another file that the user inputs. I'm having a problem instantiating all of my functions that I will need in my LinkedSet.
I'm getting the error code:
In function ‘int main()’:
.../projects/project3/LinkedSetTester.cpp:138:26: error: cannot declare variable ‘Set’ to be of abstract type ‘LinkedSet<std::__cxx11::basic_string<char> >’
LinkedSet<std::string> Set;
Along with some other notes.
I know it is because I have it declared as a virtual method and something with my arguments must be off, I just can't seem to find out where! Any help would be greatly appreciated.
Thanks,
Beez
#ifndef _SET_INTERFACE
#define _SET_INTERFACE
#include <vector>
usingnamespace std;
/** @class SetInterface SetInterface.h "SetInterface.h"
*
* Definition of SetInterface class template. */
template <typename ItemType>
class SetInterface {
public:
/** Virtual destructor. */
virtual ~SetInterface() {}
/** Gets the current number of entries in this set.
*
* @return The integer number of entries currently in the set. */
virtualint size() const = 0;
/** Sees whether this set is empty.
*
* @return True if the set is empty, or false if not. */
virtualbool isEmpty() const = 0;
/** Gets the maximum number of items allowed in a set
* @return The integer number of maximum items allowed in a set
*/
virtualint getCapacity() const = 0;
/** Sets the maximum number of items allowed in a set
* @post The capacity member of the Set instance will be set to
* whatever number was passed in
* @param num The maximum number of items that can be stored in a set
*/
virtualvoid setCapacity(int) = 0;
/** Counts the number of times a given entry appears in set.
*
* @param anEntry The value of the entry to be counted.
*
* @return The number of times anEntry appears in this set.
*/
virtualint count(const ItemType&) const = 0;
/** Adds a new entry to this set.
*
* @post If successful, newEntry is stored in the set and the
* count of items in the set has increased by 1.
*
* @param newEntry The object to be added as a new entry.
*
* @return True if addition was successful, or false if not. */
virtualbool add(const ItemType&) = 0;
/** Removes one occurrence of a given entry from this set, if
* possible.
*
* @post If successful, anEntry has been removed from the set and
* the count of items in the set has decreased by 1.
*
* @param anEntry The value of the entry to be removed.
*
* @return True if removal was successful, or false if not. */
virtualbool remove(const ItemType& ) = 0;
/** Removes all entries from this set.
*
* @post This set contains no items (thus the count is 0). */
virtualvoid clear() = 0;
/** Tests whether this set contains a given entry.
*
* @param anEntry The value of the entry to locate.
*
* @return True if this set contains anEntry, or false
* otherwise. */
virtualbool contains(const ItemType& ) const = 0;
/** Converts this set into a vector.
*
* @return A vector containing all the entries in this set. */
virtual vector<ItemType> toVector() const = 0;
};
#endif