在我的Ah文件中:
class A{
private:
unsigned short PC;
public:
A():PC(0){}
virtual ~A(){}
virtual void execute(unsigned short PC)=0;
};
Run Code Online (Sandbox Code Playgroud)
在我的Bh文件中:
class B:public A{
private:
int status;bool exe;
public:
B:status(0),exe(false){}
virtual B(){}
void execute (unsigned short PC);
};
Run Code Online (Sandbox Code Playgroud)
在我的B.cpp文件中:
#include <iostream>
#include "B.h"
void B::execute (unsigned short PC){
cout << "Run";
}
Run Code Online (Sandbox Code Playgroud)
在我的Functions.h文件中:
#include "A.h"
class Functions{
public:
int status;
Functions():status(1){} // this is a constructer
void run(A *a);
};
Run Code Online (Sandbox Code Playgroud)
在我的Functions.cpp文件中:
#include "Functions.h"
#include "A.h"
#include "B.h"
using namespace std;
void Functions::run (A …Run Code Online (Sandbox Code Playgroud) c++ ×1