From 52a903112a79c00b51f72f8572eafa8908e2d708 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 13 Feb 2014 14:28:55 +0100 Subject: [PATCH] Coding style: Add a comment on Aggregation vs Inheritance Change-Id: Ied68af7f63e34a05a087b80be0f219f9ccd4e8eb Reviewed-by: Daniel Teske Reviewed-by: Leena Miettinen --- doc/api/coding-style.qdoc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/api/coding-style.qdoc b/doc/api/coding-style.qdoc index 3d298fba088..7d1da3d958b 100644 --- a/doc/api/coding-style.qdoc +++ b/doc/api/coding-style.qdoc @@ -893,6 +893,16 @@ Suddenly, QList symbols are exported from two libraries which results in a clash. + + \section2 Inheritance Versus Aggregation + + \list + \li Use inheritance if there is a clear \e{is-a} relation. + \li Use aggregation for re-use of orthogonal building blocks. + \li Prefer aggregation over inheritance if there is a choice. + \endlist + + \section2 Conventions for Public Header Files Our public header files have to survive the strict settings of