25 lines
516 B
C
25 lines
516 B
C
|
#ifndef __SHOPPINGCART_H__
|
|||
|
#define __SHOPPINGCART_H__
|
|||
|
|
|||
|
#include "Element.h"
|
|||
|
#include "Visitor.h"
|
|||
|
#include <vector>
|
|||
|
|
|||
|
class ShoppingCart
|
|||
|
{
|
|||
|
public:
|
|||
|
ShoppingCart(){}
|
|||
|
void addElement(Element* element){
|
|||
|
printf(" <20><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>%s, \t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d, \t<EFBFBD><EFBFBD><EFBFBD>빺<EFBFBD>ﳵ<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>\n", element->getName().c_str(), element->getNum());
|
|||
|
elementList.push_back(element);
|
|||
|
}
|
|||
|
void accept(Visitor* visitor){
|
|||
|
for (int i = 0; i < elementList.size(); i++){
|
|||
|
elementList[i]->accept(visitor);
|
|||
|
}
|
|||
|
}
|
|||
|
private:
|
|||
|
vector<Element*>elementList;
|
|||
|
};
|
|||
|
|
|||
|
#endif
|