当我无法检测到代码中的任何错误时,我收到了虚拟表错误。有人可以给我一个正确方向的观点吗?对不起荷兰语术语,希望这不是问题。
#ifndef LIJST_H
#define LIJST_H
#include "product.h"
#include <list>
typedef list<Product*> lijst;
#endif // LIJST_H
// Methode
#ifndef METHODE_H
#define METHODE_H
#include "lijst.h"
class Methode
{
public:
Methode() {}
virtual ~Methode() {}
virtual double run(lijst *items);
};
#endif // METHODE_H
// Productmethode
#ifndef PRODUCTMETHODE_H
#define PRODUCTMETHODE_H
#include "methode.h"
class ProductMethode : public Methode
{
private:
map<string,double> kortingsTabel;
public:
ProductMethode() {}
void addKorting(string naam, double korting);
double run(lijst *items);
};
// Main
#include <QCoreApplication>
#include "factuur.h"
#include "product.h"
#include "globalemethode.h"
#include "productmethode.h"
#include "drempelmethode.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
GlobaleMethode G ( 0.1 );
ProductMethode P;
P.addKorting ( "Melk", 0.1 );
P.addKorting ( "Boter", 0.05 );
Factuur F ( &G );
F.addProduct ( new Product ( "Melk", 0.75 ) );
F.addProduct ( new Product ( "Kaas", 5 ) );
F.addProduct ( new Product ( "Boter", 1.7 ) );
cout << F.totaal ( ) << endl;
F.setMethode ( &P );
cout << F.totaal ( );
return a.exec();
}