Next:
Using Default Arguments with
Up:
week2
Previous:
Access Functions and Utility
Initializing Class Objects: Constructors
Constructors
Initialize data members; Or can set later
Same name as class
No return type
Initializers
Passed as arguments to constructor
In parentheses to right of class name before semicolon
Class-type ObjectName( value1,value2,...};
The programmer provides the constructor, which is then invoked each time an object of that class is created (instantiated).
2004-07-01