Ask Question
15 July, 14:55

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.

+3
Answers (1)
  1. 15 July, 16:33
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers