Ask Question
30 November, 13:44

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.

+5
Answers (1)
  1. 30 November, 13:50
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers