Код: Выделить всё
class Solution {
struct TypeText{
//some code, attributes and methods
};
struct TypePattern{
//some code, attributes and methods
void printPattern(){} //this is the debug function that get's called in a weird way
};
TypeText text;
TypePattern pattern;
bool increaseOccurrencies(){
//some code
pattern.printPattern();
//some code
}
public:
bool isMatch(string s, string p){
TypeText text(s);
TypePattern pattern(s);
//some code
pattern.printPattern(); //if I call this method here, it prints the correct values of pattern
increaseOccurrencies(); //if I call this method, that then calls pattern.printPattern, it prints a "new" pattern which is void (it has experienced only the default contructor and didn't receive the string p)
//some code
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... s-while-ot