Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Creating Your First Template | Creating First Template
C++ Templates
course content

Contenido del Curso

C++ Templates

C++ Templates

1. Creating First Template
2. Templates Usage
3. Template Specialization
4. Class
5. Template Metaprogramming

Creating Your First Template

Creating a template is actually quite simple, and it's one of the easiest parts of using them. To start, you'll need to create either a function or a class. We will start with the function.

cpp

main

copy
123456
void MyFirstTemplate() { } int main() { MyFirstTemplate(); }

As you can see, there is a very simple function that does nothing for now. We can easily call it inside the main function. Your task now is to turn it into a template.

Tarea

  • Follow the comments and turn the function into a template.

Once you've completed this task, click the button below the code to check your solution.

Tarea

  • Follow the comments and turn the function into a template.

Once you've completed this task, click the button below the code to check your solution.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 1. Capítulo 2
toggle bottom row

Creating Your First Template

Creating a template is actually quite simple, and it's one of the easiest parts of using them. To start, you'll need to create either a function or a class. We will start with the function.

cpp

main

copy
123456
void MyFirstTemplate() { } int main() { MyFirstTemplate(); }

As you can see, there is a very simple function that does nothing for now. We can easily call it inside the main function. Your task now is to turn it into a template.

Tarea

  • Follow the comments and turn the function into a template.

Once you've completed this task, click the button below the code to check your solution.

Tarea

  • Follow the comments and turn the function into a template.

Once you've completed this task, click the button below the code to check your solution.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 1. Capítulo 2
toggle bottom row

Creating Your First Template

Creating a template is actually quite simple, and it's one of the easiest parts of using them. To start, you'll need to create either a function or a class. We will start with the function.

cpp

main

copy
123456
void MyFirstTemplate() { } int main() { MyFirstTemplate(); }

As you can see, there is a very simple function that does nothing for now. We can easily call it inside the main function. Your task now is to turn it into a template.

Tarea

  • Follow the comments and turn the function into a template.

Once you've completed this task, click the button below the code to check your solution.

Tarea

  • Follow the comments and turn the function into a template.

Once you've completed this task, click the button below the code to check your solution.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Creating a template is actually quite simple, and it's one of the easiest parts of using them. To start, you'll need to create either a function or a class. We will start with the function.

cpp

main

copy
123456
void MyFirstTemplate() { } int main() { MyFirstTemplate(); }

As you can see, there is a very simple function that does nothing for now. We can easily call it inside the main function. Your task now is to turn it into a template.

Tarea

  • Follow the comments and turn the function into a template.

Once you've completed this task, click the button below the code to check your solution.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 1. Capítulo 2
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt