Ask Question
25 July, 23:49

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

+3
Answers (1)
  1. 26 July, 00:59
    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 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