previous | start | next

Constructors with Parameters (Syntax 6.4 : Constructors with Field Initializer List)

Syntax 6.4 : Constructors with Field Initializer List

Class_name::Class_name(parameters):field1(expression), ..., fieldn(expression){  statements
}
Example:
Point::Point(double xval, double yval):
x(xval), y(yval) { }
Purpose: Supply the implementation of a constructor, initializing data fields before the body of the constructor.


previous | start | next