Back In the print window choose "Save as PDF" as the destination
NOTE.CS

Templates

1 topic ยท 28 Nov 2026
1

Templates

C++

Templates let one function or class work with any data type (generic programming). The STL is built on templates.

C++
template <typename T>
T getMax(T a, T b) {
    return (a > b) ? a : b;
}

getMax(3, 7);        // 7
getMax(2.5, 1.5);    // 2.5
getMax<char>('a', 'z');