Search code examples
c++umlclass-diagram

Adding constructors and destructors in a UML class diagram for C++ classes


When writing a UML class diagram for C++ code, is it necessary to include constructors and destructors of the relevant class?


Solution

  • In many cases, adding constructors/destructors to a C++ class diagram would just be textual boilerplate noise and not really meaningful. Only if you want your diagram to be a complete documentation of your C++ classes, you may want to add constructors.

    Contrary to what @Marco is saying below, this is not a matter of the underlying business logic, but a purely ergonomic issue of avoiding cluttering and noise in (typically complex) diagrams.