Apache C++ Standard Library User's Guide

## 26.6 An Example of a Derived Facet Class

As mentioned previously, the phone _put facet class is intended to serve as a base class. The facet does not format phone numbers in a locale-specific fasion.. Let's now present an example of a derived facet class, the US phone number formatting facet. This facet initializes the base class with the string "US" and its own locality, and the prefix for dialing foreign numbers, "011"; it works by default with the static country code table. Here is the class declaration for the facet:

    class US_phone_put : public phone_put {
    public:
      US_phone_put (CodeMap* codeMap = 0, bool delete_it = false,
                    std::size_t refs = 0)
        : phone_put ("US", "011", codeMap, delete_it, refs) { }
    };

Other concrete facet classes are built similarly.