Cpp Coding Standards/DESIGN/DIP

From Apache OpenOffice Wiki
Jump to: navigation, search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Dependency inversion principle (DIP):

  • high-level modules should not depend on low-level ones. Instead, they should both depend on abstractions.
  • abstractions should not depend on details, but details should depend on abstractions.

Implement DIP by using abstract interfaces (a class consisting of pure virtual functions only). Typically, provide a public virtual destructor to facilitate polymprphic deletion.

See the original article for further explanation.

Personal tools