0

How to inherit class methods from template classes?

I'm working on a calculator project that requires me to work with different data types(hence me using templates), and keep getting the error when i try to output the number(member ShowNumber is not part of Class Calculator. I'm assuming this is because i haven't properly inherited from the base class(?) even if that is the case, could someone show me how to properly create template speacialized child classes? thanks in advance. code(i'm working in VS, so i'm only showing the header.): https://code.sololearn.com/c11pKw3HtOZ8

25th Oct 2017, 6:23 PM
X-1
X-1 - avatar
1 Resposta
+ 3
I am not sure if you can inherit a base template class into its specialization. Maybe you just cannot. //Im getting the error as - template parameters not deducible in partial specialization. //After all, you will have to specify B in main, but then, whats the point when all you wanted was a double type? And why do you wish to specialize the class for doubles etc with the general calculator class when what you need is: template<> class Calculator<double> : public Base<double> {}; ???
26th Oct 2017, 4:58 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar