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:
Code:
class characters
{
public:
characters();
~characters();
int wind_choice_one;
int wind_opinion;
int wind_actions (int wind_opinion); // okay, so the idea here is that as Wind's opinion increases, new dialogue options are opened up.
};
characters::characters()
{
wind_choice_one = 0;
}
characters::~characters()
{
}
int characters::wind_actions (int wind_opinion)
{
return (wind_opinion);
}
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:
Code:
characters game_characters;
Then a reference to a variable within that class:
Code:
int& wind_oppinion_reference = game_characters.wind_oppinion;
And then tried to use the statement:
Code:
wind_opinion_reference + 1;
to increase it, I got a compiler warning stating that the statement had no affect.
Even worse, when I tried to call a function from the class like:
Code:
cout << game_characters.wind_actions();
I got a compiler error which stated:|error: no matching function for call to '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.