Hello all. I've been trying to make a class of functions that track certain responses that a player makes in my text adventure and modify the dialogue options based on each game character's opinion of the player. Unfortunately, I think I may have done something very wrong with the class definition.
I defined the class and the functions within it like this:
The definition seems to fit well with what this site's tutorial suggested, but when I defined an instance of the class in main like so:
int wind_actions (int wind_opinion); // okay, so the idea here is that as Wind's opinion increases, new dialogue options are opened up.
wind_choice_one = 0;
int characters::wind_actions (int wind_opinion)
Then a reference to a variable within that class:
And then tried to use the statement:
int& wind_oppinion_reference = game_characters.wind_oppinion;
to increase it, I got a compiler warning stating that the statement had no affect.
wind_opinion_reference + 1;
Even worse, when I tried to call a function from the class like:
I got a compiler error which stated:|error: no matching function for call to 'characters::wind_actions()'|
cout << game_characters.wind_actions();
I compared my code to the example code from the tutorial on classes on this site and couldn't see anything obviously wrong with it. I tried modifying the function definition and moving the lines outside of any switch cases and loops which might have prevented the statements from making modifications, but nothing seems to work.
Does anything about the way I defined the class seem off?
I would be deeply grateful for any help I could get.