I think the following code should work:
// Base.h
class Base
{
public:
Base() = default;
virtual ~Base() = default;
};
// Derived.h
class Derived : public Base
{
public:
Derived();
~Derived() override;
};
// Derived.cpp
Derived::Derived()
: Base()
{
// do some work
}
Derived::~Derived()
{
// do some work
}
I get "unresolved external symbol" linker error for both the constructor and destructor of the base class. However if I change the = default to { }, everything works.
Am I missing something from the specification?
PS. I'm using VS2013.
Aucun commentaire:
Enregistrer un commentaire