Ask Question
4 November, 06:15

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

+5
Answers (1)
  1. 4 November, 06:36
    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?
Find an answer to your question 👍 “What is a constructor? Why would you include a constructor in a class? ...” 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