Listing 6: The class declaration of abstract_parser and concrete_parser
// Copyright (c) 2001, Joel de Guzman and Dan Nuffer // Permission is granted to use this code without restriction as // long as this copyright notice appears in all source files. template <typename IteratorT> class abstract_parser { public: abstract_parser() {} virtual ~abstract_parser() {} virtual match parse( IteratorT& first, IteratorT const& last) const = 0; }; template <typename ParserT, typename IteratorT> class concrete_parser : public ParserT , public abstract_parser<IteratorT> { public: concrete_parser(ParserT const& parser) : ParserT(parser) {} virtual ~concrete_parser() {} virtual match parse(IteratorT& first, IteratorT const& last) const { return ParserT::parse(first, last); } };