Can anyone help with number 9 exercise here;
Been scratching my head a wee while now, I can’t figure out how in the SetHobbies method I assign the class field value string hobbies the values from the string array being passed into on the method.
As its an array I thought to loop through using for loop and increment each element of this.hobbies[i] = hobbies[i], however I’m getting an error that the fields are not being initialised.
I tried to copy the array from passed in parameter hobbies to this.hobbies with no luck either.
I’ve checked the incoming supplied array, it has 3 values in it, and with a foreach I can write output to console so know the values are in the incoming array - but for the life of me I haven;t had luck assigning the actual field members.
Any tips, I’m sure I’m missing something basic here!
Any help appreciated.