彩票兑奖小程序

//各种彩票类的父类
class Ticket
{
protected:
    std::vector data_;
public:
    Ticket(std::string ticket_str);
    Ticket(){}
    sector getSector(int index) const;

    bool isMultiple();
    virtual size_t firstLength()=0;
    virtual size_t secondLength()=0;
    virtual void parse(std::string s);
    virtual boost::shared_ptr  CreateSafeInstance()=0;
    virtual std::vector& getData(boost::shared_ptr ticket)=0;

    virtual std::ostream& formatedCout(std::ostream& o) const{return o<    virtual const char* sep_char() const{return " ";}

    std::vector  > getTickets();

    std::string ticketId;

    friend std::ostream &operator<<(std::ostream &o,const Ticket &t);
};


 超级大乐透

class BigHappyTicket: public  Ticket
{
public:
 BigHappyTicket(std::string ticket_str);
 BigHappyTicket(){}
 virtual size_t firstLength(){return 5;}
 virtual size_t secondLength(){return 2;}
 virtual boost::shared_ptr  CreateSafeInstance();
 virtual std::vector& getData(boost::shared_ptr ticket);

};

双色球

class Color2Ticket: public  Ticket
{
public:
 Color2Ticket(std::string ticket_str);
 Color2Ticket(){}
 virtual size_t firstLength(){return 6;}
 virtual size_t secondLength(){return 1;}
 virtual boost::shared_ptr  CreateSafeInstance();
 virtual std::vector& getData(boost::shared_ptr ticket);


};

 

略……

你可能感兴趣的:(C++)