template with method depending on type

Dear all,
Thank you for taking the time to read this. Here is my question:

Let say I create template class

template <class Type_a>
class My_Class
{
private:
...
protected:
Type_a a ;
Type_b b ;
...
public:
My_Class()
{
... do what needs to be done ...
};
...
}

Now let us assume that when calling My_Class < int > I want the constructor to initiate a=0 and b=1,

however, when calling My_Class < float > I want to have the constructor to initiate a=0.1 and b=1.2

Do you see a way to proceed ?

I hope I made the problem clear.

Best
Have you heard of template specialization? If not, I would recommend you to google it.
Great, thank you golden chicken
Topic archived. No new replies allowed.