-2

Why do I keep getting an error on compile with this code?

#ifndef OPERATOR_H
#define OPERATOR_H
#include <cstdlib>
#include <iostream>
#include <string>
#include "Individual.h"

using namespace std;

class Operator
{
public:
Operator();

virtual void execute (Individual* parent);

private:

};
#endif

Then in the cpp file I have

#include <cstdlib>
#include <iostream>
#include <string>
#include "Operator.h"

using namespace std;

Operator::Operator()
{  

}

void execute(Individual* parent)
{    

}
Karthik T
  • 31,456
  • 5
  • 68
  • 87
user2661167
  • 491
  • 5
  • 13
  • 22

1 Answers1

0

Define a destructor. The vtable for a class with virtual methods is created in the translation unit that defines the constructor.

In your header, add:

virtual ~Operator();

And in your source file, add:

Operator::~Operator() {
}
Tyler McHenry
  • 74,820
  • 18
  • 121
  • 166