Skip to content

Instantly share code, notes, and snippets.

@marciojrtorres
Created August 5, 2013 20:46
Show Gist options
  • Save marciojrtorres/6159466 to your computer and use it in GitHub Desktop.
Save marciojrtorres/6159466 to your computer and use it in GitHub Desktop.
Impondo restrições com tipagem estática, um exemplo em C++
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