Ask Question

The class constructor cannot have any return type?

+5
Answers (1)
  1. 7 August, 02:11
    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 & 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