next up previous
Next: How do I initialize Up: class and struct Previous: How do I create

How do I initialize members of a class?

There are two ways.
struct  A
{
  int   a;
  int   b;
  A(): a(0) { b = 0; } // attribute a and b are initialized to 0
};



Alexis Angelidis (PhD) 2005-01-11