8-129 繞過形參限制(最簡單的模版)

這裏寫圖片描述

#include "stdafx.h"
#include <iostream>
using namespace std;

template<class T> void output(T a)  //模版輸出函數
{
    cout<<a<<endl;
}

int main(int argc, char* argv[])
{
    output(1);
    output(3.4);
    return 0;
}
發佈了82 篇原創文章 · 獲贊 40 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章