Skip to content

Instantly share code, notes, and snippets.

@lrodorigo
Last active March 8, 2021 17:05
Show Gist options
  • Save lrodorigo/0275a6fea857e0d23df945c8894fed52 to your computer and use it in GitHub Desktop.
Save lrodorigo/0275a6fea857e0d23df945c8894fed52 to your computer and use it in GitHub Desktop.
class Prova {
public:
bool dataValid() {
return abs(this->data - INVALID_VALUE) > 1;
}
protected:
int32_t data{INVALID_VALUE};
const int32_t INVALID_VALUE{-999};
};
//
int main() {
Prova p;
std::cout << p.dataValid() << std::endl; // perché torna true?
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment