previous | start | next

## Templates (Syntax 17.3 Template Class Definition)

Syntax 17.3 : Template Class Definition
    template<typename type_variable>
    class class_name
    {   features
    };
Example: |
    template<typename T>
    class Pair
    {
    public:
       Pair(T a, T b);
       T get_first() const;
       T get_second() const;
    private:
       T first;
       T second;
    };
Purpose: | Define a class template with a type parameter.

previous | start | next