In my Ah file:
class A{
private:
unsigned short PC;
public:
A():PC(0){}
virtual ~A(){}
virtual void execute(unsigned short PC)=0;
};
In my Bh file:
class B:public A{
private: int status;bool exe;
public:
B:status(0),exe(false){}
virtual B(){}
void execute (unsigned short PC);
};
In my B.cpp file:
#include <iostream>
#include "B.h"
void B::execute (unsigned short PC){
cout << "Run";
}
In functions.h file:
#include "A.h"
class unctions{
public: int status;
Functions():status(1){}
void run(A *a);
};
In my functions.cpp file:
#include "Functions.h"
#include "A.h"
#include "B.h"
using namespace std;
void Functions::run (A *a){
a->execute;
}
In my Main.cpp file:
#include "A.h"
#include "B.h"
int main(int args, char**argv){
A *a;
B b;
a = &b;
Functions f;
f.run(a);
return 1;
}
When I run, it has some error: "a pure virtual method called - terminating a call without an active exception -" Aborted ", Can someone where I misunderstood? Thank you
source
share