I can deal with porting platform dependent functions. I have a problem that the
ID: 653156 • Letter: I
Question
I can deal with porting platform dependent functions. I have a problem that the compilers I tried on Linux (clang and g++) do not accept the following code, while the msvc++ compiler does:
template <class T>
class Base {
protected:
T Value;
};
template <class T>
class Derived : public Base<T> {
public:
void setValue(const T& inValue){
Value = inValue;
}
};
int main(int argc, char const *argv[])
{
Derived<int> tmp;
tmp.setValue(0);
return 0;
}
g++ error:
main.cpp: In member function
Explanation / Answer
I also posted this question on SO. From the few comments here and the answers there I reach the same conclusion: I have to fix my code. Adding my own answer so I can mark this question as accepted/resolved.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.