Quote:
i expect "GetQuestionAsked" to now contain the same value as speech
i did a break point to check the value change but it still shows the value is null
If you have done this:
string speech = "WHAT IS UR NAME";
QuestionAsked question = new QuestionAsked();
question.GetQuestionAsked = (speech);
Then
question.GetQuestionAsked
will contain the same value as
speech
- but only for that one instance. If you create a different instance, it will not contain a value unless you execute similar code on that instance.
Think about cars for a moment - you are driving your car, and you put your mobile in the glove box. Then you buy a new car and drive off in that. Would you expect to find your mobile in the new car's glove box?
Of course not - you understand intuitively that the two vehicles are separate instances of the class "car", and that what you do to a specific instance doesn't affect any other.
It's the same with your
QuestionAsked
class - what you do to one instance does not affect any other (except with
static
data, and you'll probably meet that soon).