Graphviz + Doxygen to generate UML class diagrams

Create the following source file example.cpp:

class Animal
{
  public:
    void die();
    string name;
    int age;
};

class Dog : public Animal
{
  public:
    void bark();
};

class Cat : public Animal
{
  public:
    void meow();
};

run doxygen -g and change the following options of the generated Doxyfile:

EXTRACT_ALL            = YES
HAVE_DOT               = YES
UML_LOOK               = YES

run doxygen and look at the output for the Animal class, it should be the similar as the above picture, although doxygen will not show the return types of the methods and fields.

Leave a Comment