Ask Question
21 June, 11:51

In C++, a class is allowed to have more than one constructor.

Select one:

True

False

+5
Answers (1)
  1. 21 June, 12:01
    0
    True

    Explanation:

    In C++, a class is allowed to have more than one constructor. For example:

    class Demo

    {

    private:

    int val;

    public:

    Demo ();

    Demo (int val);

    ~Demo ();

    };

    Demo::Demo (int value)

    {

    / / Single argument constructor

    val=value;

    }

    Demo::Demo ()

    {

    / / Zero argument constructor

    val = 0;

    }

    Demo::~Demo ()

    {

    / / Class Destructor

    }

    This example has two constructors - 1 with no arguments and the other with one argument.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “In C++, a class is allowed to have more than one constructor. Select one: True False ...” 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