0

So basically I'm making a generic class for rational numbers, and I want to do automatic type conversions in comparisons and operations and constructors. How would I go about doing this? Google has only returned results for template functions

rational.h

```
#ifndef RATIONAL_H
#define RATIONAL_H
class rational {
public:
rational();
~rational();
template<typename type>
rational(const type&);
private:
int n,d;
}
```

```
#include "rational.h"
rational::rational() {
n = d = 0;
}
rational::~rational(){
}
//heres where I don't know what to do
template<typename type>
rational::rational(const type&) {
//specialized function for int and float conversion
}
```

thanks for the help

*Edited 7 Years Ago by SeeTheLite*: made two public declarations