Ask Question
8 November, 14:28

The class constructor cannot have any return type?

+5
Answers (1)
  1. 8 November, 17:35
    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?
Get an answer to your question ✅ “The class constructor cannot have any return type? ...” 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