Ask Question
6 July, 13:13

The class constructor cannot have any return type?

+2
Answers (1)
  1. 6 July, 16:13
    0
    No.

    Explanation:

    The class constructor does not have any return type. The constructor does not return any value. The constructor is used to initialize an object. The constructor of the class has the same name as the class. For example:-

    class Number{

    private:

    int a;

    int b;

    };

    For this class the constructor name is Number ().

    The default constructor is always present in the class when the class is created. It gets deleted when the user defines it's new parameterized constructor.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “The class constructor cannot have any return type? ...” 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