Constructors with Arguments
Constructors can take arguments, allowing (or even forcing) the user specify some initialization information when creating an instance of a class.
// We are defining a constructor that takes an argument --
// so the default constructor is not generated
counter(int initial_value) { counter_p = initial_value; }
// ...same increment(), decrement(), and get_value()
counter a; // ILLEGAL - compile-time error because the
// default constructor no longer exists!
counter c(“Hi”); // ILLEGAL - Expecting int, got char *
counter d(4, 5); // ILLEGAL - Expecting one int, got two