Ask Question
25 May, 06:50

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

Select one:

True

False

+5
Answers (1)
  1. 25 May, 08:49
    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?
Find an answer to your question ✅ “In C++, a class is allowed to have more than one constructor. Select one: True False ...” 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