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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.