Introduce common data class
From CSSEMediaWiki
(Difference between revisions)
(category and see also) |
|||
Line 1: | Line 1: | ||
+ | ---- | ||
+ | <div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;"> | ||
+ | ---- | ||
+ | =[http://ezemitekywe.co.cc UNDER COSTRUCTION, PLEASE SEE THIS POST IN RESERVE COPY]= | ||
+ | ---- | ||
+ | =[http://ezemitekywe.co.cc CLICK HERE]= | ||
+ | ---- | ||
+ | </div> | ||
Instead of having the same attributes in two (or more) classes, the common data should be put into a separate class. In C/C++, a structure is often used to manage common data. Because of the maxim [[Favor composition over inheritance]], using an external data class is better than moving the common data into a base class. This should only be done if common behaviour is also shared (see [[Introduce common base class]]). | Instead of having the same attributes in two (or more) classes, the common data should be put into a separate class. In C/C++, a structure is often used to manage common data. Because of the maxim [[Favor composition over inheritance]], using an external data class is better than moving the common data into a base class. This should only be done if common behaviour is also shared (see [[Introduce common base class]]). | ||
Revision as of 07:02, 24 November 2010
Instead of having the same attributes in two (or more) classes, the common data should be put into a separate class. In C/C++, a structure is often used to manage common data. Because of the maxim Favor composition over inheritance, using an external data class is better than moving the common data into a base class. This should only be done if common behaviour is also shared (see Introduce common base class).