Explore BrainMass

Explore BrainMass

    Overloaded constructor

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write the statements to create an overloaded constructor for the class named Car. The constructors should support 0, 1, or 2 arguments. The first argument will denote the engine size and contain an Integer. The default value is 360. The second argument will denote the color and should have a type of Automobile.Color. The default value is the enumeration White. Declare constants named cintDefaultEngineSize and ccolDefaultColor to store the default values. If no arguments are supplied, then use the default value. If one argument is supplied to the constructor, then assume that the argument is defining the engine size. If two arguments are supplied to the constructor, then assume that the first argument contains the engine size and the second contains the color. For each of the constructors, store the default or specified arguments in the hidden variables named mintEngineSize and mcolDefaultColor.

    © BrainMass Inc. brainmass.com October 9, 2019, 9:01 pm ad1c9bdddf

    Solution Preview

    class Car
    enum AutomobileColor
    } ;
    static const int cintDefaultEngineSize = ...