Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15485116
  • 博文数量: 112
  • 博客积分: 11195
  • 博客等级: 上将
  • 技术积分: 1989
  • 用 户 组: 普通用户
  • 注册时间: 2005-06-20 11:04
文章分类

全部博文(112)

文章存档

2013年(2)

2012年(27)

2011年(6)

2010年(11)

2009年(6)

2007年(7)

2006年(23)

2005年(30)

分类: C/C++

2006-11-23 15:02:07

#include
using namespace std;
template class X
{
 T x;
public:
 X(T i):x(i){}
 void print()
 {
        cout< }

};
int main()
{
        X obj(10);
        obj.print();
        return 0;
}

[root@localhost zjj]# gcc  -o test test.cpp -lstdc++;./test
10
[root@localhost zjj]# gcc -c test.cpp
[root@localhost zjj]# g++ -o test test.o
[root@localhost zjj]# ./test
10
[root@localhost zjj]# cp test.cpp test.c
[root@localhost zjj]# gcc  -o test test.c -lstdc++
test.c:1:20: iostream: No such file or directory
[root@localhost zjj]# gcc  -c test.c
test.c:1:20: iostream: No such file or directory
[root@localhost zjj]# g++ -o test test.c
[root@localhost zjj]# ./test
10
阅读(64408) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~