Difference between revisions of "Cpp Coding Standards/DESIGN/DIP"
From Apache OpenOffice Wiki
B michaelsen (Talk | contribs) |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 4: | Line 4: | ||
Implement DIP by using abstract interfaces (a class consisting of pure virtual functions only). Typically, provide a public virtual destructor to facilitate polymprphic deletion. | 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 [http://www.objectmentor.com/resources/articles/dip.pdf the original article] for further explanation. | ||
+ | [[Category:Coding Standards]] |
Latest revision as of 17:07, 14 December 2009
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.