Function Templates in C++: Writing Independent Code for Processing Different Data Types, Lecture notes of Computer Programming

The concept of function templates in c++ programming. Function templates are blocks of independent code that can process different types of data passed to them by the user. They enable the user to write less code by avoiding the need to write multiple functions for different data types. A syntax and working example of function templates.

Typology: Lecture notes

2019/2020

Uploaded on 02/24/2020

mubashra-munir
mubashra-munir 🇵🇰

1 document

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
FUNCTION TEMPLATE
Mubashra Munir
18CS01
Saira Siddique
18CS23
pf3
pf4

Partial preview of the text

Download Function Templates in C++: Writing Independent Code for Processing Different Data Types and more Lecture notes Computer Programming in PDF only on Docsity!

FUNCTION TEMPLATE

  • (^) Mubashra Munir 18CS
  • (^) Saira Siddique 18CS

FUNCTION+TEMPLATES

FUNCTION

Named block of code that performs some action. Syntax: Return-type function name(parameters)

TEMPLATE

Foundation of generic programming, writing code in a way that is independent of any particular type. Syntax: template T FunctionName(T Parameter(s))