I am going to write some class for test like following files.
I get some errors when I compile those files: I call inherited function via derived class. but the compiler says that undefined reference to 'Base<someStruct>::func()'
.
I get this error where I try to call inherited member function actually.
the base class and derived class are in the same file. why I get this error?
//tool.h
template <class Addr>
struct Base {
...
public:
bool func();
...
}
class Tool : public Base<struct someStruct> {
...
public:
int func1();
...
}
and the following is implementation file.
//tool.cpp
#include "tool.h"
template <class Addr>
bool Base<Addr>::func()
{
...
}
int Tool::func1()
{
}
the main
is here:
//test.c
#include "tool.h"
int main()
{
Tool tool;
tool.func(); //error is here;
}