View Full Version : c++ vector class help needed

10-23-2004, 02:43 AM
This is my first post and I need some help constructing a class. The class contains a struct in the private section with a few kinds of data types in it. After the struct is defined, I need to define a vector using that struct as its data type.

I am receiving a compiler error when I include a constructor in the struct.
When there is no constructor in the struct, everything compiles fine. Can someone please clue me in as to what is wrong. Thanks.

PS. I am using MSVC .NET

//header file for Class "Hash"

#include <iostream>
#include <vector>
#include <string>
using namespace std;

class TennisHash
TennisHash( const string & notFound, int size = 101 );
//TennisHash( const TennisHash & rhs )
//array( rhs.array ), currentSize( rhs.currentSize ) { }

void Add();

void Challenge();

void Exchange();

struct HashEntry
string Name;
string Challenger;
int Rank;

HashEntry::HashEntry(string & n, string & nc, int r)
Name = n;
Challenger = nc;
Rank = r;


string NextChallenge;
int NextRank;
int TableSize;
const string ITEM_NOT_FOUND;
vector<HashEntry> array;



10-27-2004, 08:27 AM
It seems to compile fine just as you have it posted here, with the constructor in the struct.