Ask Question

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

Select one:

True

False

+3
Answers (1)
  1. 9 October, 21:32
    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 & 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