Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- template <class tipo>
- tipo valor(tipo v){
- return v;
- }
- //auto seria casi lo mismo que el template
- auto retornarValor(auto n){
- return n;
- }
- int main(){
- cout << valor("uno") << endl;
- cout << valor(10) << endl;
- cout << valor('A') << endl;
- cout << "------------------\n\n";
- //probando a la funcion de tipo auto
- cout << retornarValor(20) << endl;
- cout << retornarValor("rosado") << endl;
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement