Ask Question
1 February, 23:04

What is a constructor? Why would you include a constructor in a class?

+5
Answers (1)
  1. 2 February, 00:10
    0
    Constructor in the class is the member function that gets into action when any new object gets created in the class, it gets invoked. It does not have any return type and no void return.

    The constructor is used in the class because there is the requirement for the initializing of the new object and then only object can do the functioning in the program.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What is a constructor? Why would you include a constructor in a class? ...” 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