C + + template templates

Source: Internet
Author: User

Precede the class declaration with a row, format:

Template <class virtual type parameter;

such as: Template<class numtype>

Class compare{...};

Use the class template to define an object in the following form:

Class template name < actual parameter type > object name;

Class template name < actual parameter type > object name (argument list);

Such as:

Compare <int> Cmpl;

Compare <int > Cmpl (3,7);

If you define a member function outside of a class template, you should write it as a class template:

Template <class Virtual type parameters >

function type class template name < virtual type parameter;:: member function name (function parameter list) {...}

C + + template templates

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.