I keep getting that weird compile error "LNK2019 unresolved external symbol" c++. I want to create a template function that will take different class as it's parameter. Event and Items are the classes I have created.
template<typename C>
void viewFunction(C customClass, char ch){
if(ch = 'E'){
customClass.printName();
customClass.printPrice();
}
else{
customClass.printName();
customClass.printSize();
customClass.printWeight();
}
}
Now I called that function in main. The error happens when I try to pass in a class as my template type, I think.
int main{
Event myEvent1;
Event myEvent2;
Item myItem1;
Item myItem2;
viewFunction(myEvent1, 'E');
viewFunction(myItem1, 'I');
viewFunctionmyEvent2, 'E');
viewFunction(myItem2, 'I');
return 0;
}