68. Generating random passwords

This problem could be solved using the composite pattern or a variation of the pattern. This design pattern composes objects into tree hierarchies and enables treating groups (or trees) of objects the same way as individual objects of the same type. The following class diagram shows a hierarchy of classes that can be used for generating passwords:

password_generator is the base class and has several virtual methods: generate() returns a new random string, length() specifies the length of the strings it generates, allowed_chars() returns a string with all the characters it uses for generating passwords, and ...

Get The Modern C++ Challenge now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.