The following program deploys both the default constructor and a constructor with parameters:
#includeconst double pi = 3.14159; class tank_car { public: double radius, length; tank_car ( ) {radius = 3.5; length = 40.0;} tank_car (double r, double l) {radius = r; length = l;} double volume ( ) {return pi * radius * radius * length;} }; main ( ) { tank_car t1; tank_car t2 (3.5, 50.0); cout << "The volume of the default tank car is " << t1.volume ( ) << endl << "The volume of the specified tank car is " << t2.volume ( ) << endl; } --- Result --- The volume of the default tank car is 1539.38 The volume of the specified tank car is 1924.22