Why does my code below throw a compilation error complaining of undefined reference to Base::Base(), undefined reference to vtable for Derived and bad reloc address 0x0 in section '.ctors'. But when I define the constructor for Derived within the class, the compiler is able to compile the code.
#include <iostream>
class Base{
public:
Base();
virtual ~Base();
};
class Derived : public Base{
public:
Derived(double theob_);
virtual ~Derived();
private:
double theob;
};
Derived::Derived(double theob_):theob(theob_){}
int main(){
return 0;
}