Ask Question
6 November, 13:07

If a class contains more than one constructor, describe how the computer determines the appropriate constructor. provide an example to support your response, then comment on the examples provided by your classmates. after your initial post, be sure respond to at least two peers in this discussion.

+4
Answers (1)
  1. 6 November, 13:34
    0
    If a class contains more than one constructor, computer determines the appropriate constructor by matching all the attributes, like the number, data type and position. Here's the example where the row public AirConditioner () {} is the default constructor that can use default settings or initialize manually (sorry for tabulation, not my fault):

    class AirConditioner{ enum ConditionerMode{ Automatic, } public ConditionerMode Mode; public int MinTemperature = 18; public int MaxTemperature = 20;

    public AirConditioner () { }

    public AirConditioner (ConditionerMode mode) { Mode = mode; } public AirConditioner (ConditionerMode mode, int MinTemp, int MaxTemp) { Mode = mode; MinTemperature = MinTemp; MaxTemperature = MaxTemp; }}
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “If a class contains more than one constructor, describe how the computer determines the appropriate constructor. provide an example to ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers