Error: pure virtual method called
<p>In my AC.h file:</p>

<pre><code>#ifndef _AC_H
#define _AC_H
class AC{
private:
    unsigned short PC;
public:
    AC():PC(0){}
    virtual ~AC(){}
    virtual void test()=0;
};
#endif
</code></pre>

<p>In my R500.h file:</p>

<pre><code>#ifndef _R500_H
#define _R500_H
#include &lt;iostream&gt;
#include "AC.h"
class R500:public AC{
private: int mCStatus;
public:
    R500():mCStatus(0){}
    virtual ~R500(){}
    void test();
};
#endif
</code></pre>

<p>In my R500.cpp</p>

<pre><code>#include &lt;iostream&gt;
#include "R500.h"
using namespace std;
void R500::test(){
    cout &lt;&lt; "test called\n";
}
</code></pre>

<p>In my AF.h file</p>

<pre><code>#ifndef _AF_H
#define _AF_H
#include "AC.h"
class AF{
public: int status;
    AC *ac;
    AF():status(1){} // this is a constructer
    void menu();
    void run();
};
#endif
</code></pre>

<p>In my AF.cpp file:</p>

<pre><code>#include &lt;iostream&gt;
#include "R500.h"
#include "AF.h"
#include "AC.h"

using namespace std;
void AF::menu() {
    R500 r;
    ac = &amp;r;
    run();
}

void AF::run() {
    ac-&gt;test();
}
</code></pre>

<p>In my Main.cpp</p>

<pre><code>#include &lt;iostream&gt;
#include "AF.h"
#include "R500.h"
#include "AC.h"

using namespace std;

int main(int args, char**argv){
    AF af;
    af.menu();
    return 0;
}
</code></pre>

<p>It compiled well but when I run, it said that <br/>
pure virtual method called<br/>
terminate called without an active exception<br/>
Aborted<br/>
Can anybody tell me where were I wrong?
Thank you.</p>
