I have seen people writing code, where some of variables does not fit to be class member still used as class members. If a variable not required during the life of class instance then it is not required to have it as class member. Remember static class members are per class not per instance.
Technical Notes, White paper and presentation on LTE, GSM, GPRS, EDGE and CDMA network, 3GPP specifications, UTRAN, GERAN and non 3GPP wireless concepts. This blog also covers programming concepts like C and C++, Embedded programming, SNMP Framework, NMS/EMS, Provisioning system, small cell concepts
Monday, January 31, 2011
Best programming practice(C/C++):How to do you decide whether to have a variable as class member or static class member
Simple but people often do mistakes!
I have seen people writing code, where some of variables does not fit to be class member still used as class members. If a variable not required during the life of class instance then it is not required to have it as class member. Remember static class members are per class not per instance.
I have seen people writing code, where some of variables does not fit to be class member still used as class members. If a variable not required during the life of class instance then it is not required to have it as class member. Remember static class members are per class not per instance.
Labels:
C and C++
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment