Discussion: please help
Afficher un message
Vieux 16/10/2007, 07h56   #3
djm
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: please

On Oct 16, 11:43 am, Kai-Uwe Bux <jkherci...@gmx.net> wrote:
> djm wrote:
> > i know this may seem really stupid and silly, but i just cant figure
> > out whats the problem with this coding. any from you guys will be
> > greatly appreciated.
> > thanks
> > ive the header file and the class file which looks like this

>
> > //IndepHTable.h
> > #ifndef INDEPHTABLE_H
> > #define INDEPHTABLE_H

>
> > #include <string>
> > #include "List.h"

>
> BTW: why not <list>?
>
> > using namespace std;

>
> BadIdea(tm).
>
> This forces your decision to bring everything from std into the current
> namespace on everyone using this header.
>
>
>
> > const int TABLE_SIZE=29;

>
> > class IndepHTable
> > {
> > public:
> > IndepHTable(); //constructor - create empty table
> > ~IndepHTable(); //destructor

>
> > void put(string word, string def);

>
> > List get(string word);

>
> > void print();

>
> > private:
> > struct
> > {
> > string word;
> > List defList;
> > } dictionary[TABLE_SIZE];
> > };
> > #endif

>
> ************************************************** ************************************************** ********
>
>
>
>
>
> > and the class file is this
> > //IndepHTable.cpp
> > #include "IndepHTable.h"
> > #include "List.h"
> > #include <string>
> > #include <iostream>

>
> > using namespace std;

>
> > indepHTable::indepHTable()
> > {
> > dictionary.word.clear();
> > dictionary.defList=NULL;
> > }

>
> > indepHTable::~indepHTable()

>
> C++ is case sensitive. In the header, the name started with a capital "I".
>
>
>
> > {

>
> > }

>
> > void indepHTable::put(string word, string def)
> > {

>
> > }

>
> > List indepHTable::get(string word)
> > {

>
> > }

>
> > void indepHTable::print()
> > {

>
> > }

>
> [snip]
>
> Best
>
> Kai-Uwe Bux


thanks a lot. thanks for pointing out the probelm, just another thing
as you can see in the header file ive added the line

struct
> > {
> > string word;
> > List defList;
> > } dictionary[TABLE_SIZE];


how can i make the strings null in the constructor?
why wont this work?

dictionary.word.clear();
dictionary.defList=NULL;

thanks

  Réponse avec citation
 
Page generated in 0,07528 seconds with 9 queries