Pure Virtual Template Method | Sololearn: Learn to code for FREE!


Pure Virtual Template Method

Pure virtual templates are not allowed in c++. In the code I posted is a base class for general math behaviors which should contain basic pure virtual methods which then get inheritanced into different specific classes (atm there is just a binary one, but just imagine there is another numberbase ^^) How can I make templates for the arguments? The different return types will be solved with a member variable and a get method. https://code.sololearn.com/cJn1BLdV9s4T/?ref=app

2/11/2018 7:04:20 PM


1 Answer

New Answer


template as argument example: template <int A> void fung() { std::cout << A; } int main(){fung<10>();}