The following code demonstrates how to initialize class members in the initialiser list for more efficiency:
class A{int a;char b;float c;public: A();};A::A():a(0),b(0),c(0){}is more efficient thanA::A(){ a = 0; b = 0; c = 0;}
Home » Initializing Class Members
The following code demonstrates how to initialize class members in the initialiser list for more efficiency:
class A{int a;char b;float c;public: A();};A::A():a(0),b(0),c(0){}is more efficient thanA::A(){ a = 0; b = 0; c = 0;}
At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.
See our full editorial policy.