Last active
March 8, 2021 17:05
-
-
Save lrodorigo/0275a6fea857e0d23df945c8894fed52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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