Discussion: please help
Afficher un message
Vieux 16/10/2007, 09h20   #6
Erik Wikström
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: please

On 2007-10-16 09:57, djm wrote:
> On Oct 16, 12:26 pm, Kai-Uwe Bux <jkherci...@gmx.net> wrote:
>> djm wrote:
>> > On Oct 16, 11:43 am, Kai-Uwe Bux <jkherci...@gmx.net> wrote:
>> >> djm wrote:

>> [snip]
>> > 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;

>>
>> Because dictionary is an array. You need to iterate through it and set all
>> pointers to 0. (I think the strings will be constructed empty anyway.)
>>
>> BTW: you should give the struct a name.
>> BTW: you should also give it a constructor so that it can initialize its
>> data properly.
>>
>> Best
>>
>> Kai-Uwe Bux

>
> hmmm then do i actually need a constructor here?
> cuz
> 1. the string wil have no initial value?
> 2. the constructor in List class also makes the contents of "deflist"
> to NULL


No, you should not need a constructor if that is the case.

--
Erik Wikström
  Réponse avec citation
 
Page generated in 0,06284 seconds with 9 queries