---
title: "C++教程60 类模板"
author: "yuanyu5237"
date: "2014-07-03T15:12:20Z"
tags: []
categories: ["编程语言"]
slug: "c-60"
draft: false
lastmod: "2014-07-03T15:12:20Z"
id: 2087961
url: "https://yuandingping.iteye.com/blog/2087961"
---

```
#include <iostream>
using namespace std;

template <class T>
class Bucky{
	T first, second;
public:
	Bucky(T a, T b)
	{
		first = a;
		second = b;
	}
	T bigger();
};

template <class T>
T Bucky<T>::bigger()
{
	return (first>second?first:second);
}


int main()
{
	Bucky <int> bo(69, 105);

	cout << bo.bigger() << endl;

}
```