dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: C
Expertise: Beginner
Feb 24, 2004

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


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 than
A::A()
{
    a = 0;
    b = 0;
    c = 0;
}
Rahul Gupta
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date