0
How to solve inheritance and virtual error from two class
How to make this work (https://www.sololearn.com/en/compiler-playground/cf5D2ah15iO1) ? I am getting error in below code: #include <iostream> class testInt { protected: virtual int valueFromText() const; }; class testDouble { protected: virtual double valueFromText() const; }; template<class T> class test : public testInt, public testDouble { protected: virtual double valueFromText() const override; }; int main() { test<int> obj1; return 0; }
2 odpowiedzi
+ 3
maybe you need a conditional check? It seems that the compiler cannot determine which method to use. I adapted Solo's typechecking code.
https://sololearn.com/compiler-playground/c2YEUS4kMXn4/?ref=app
+ 1
Perfect Bob_Li