Created
August 5, 2013 20:46
-
-
Save marciojrtorres/6159466 to your computer and use it in GitHub Desktop.
Impondo restrições com tipagem estática, um exemplo em C++
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
int dobro(int n) { | |
return n * 2; | |
} | |
int main() { | |
// ok, imprime 4 | |
cout << dobro(2); | |
// esta instrução faz com o que o código não compile | |
cout << dobro("t"); | |
// esta instrução faz com o que o código não compile | |
cout << dobro("3"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment