Question: C++ Question 9 What is wrong about the class constructor below? class My Class { private: int *ptr: public: MyClass() { ptr = new int

C++ C++ Question 9 What is wrong about the class constructor below? class

Question 9 What is wrong about the class constructor below? class My Class { private: int *ptr: public: MyClass() { ptr = new int [2]; ptr[1]= 300; ptr[3] = 999; }; ptr[O] must be the first element. Optr[3] does not exist; it is out of bound of the array. Optr[1] = 300; is not a legal statement. a and b are correct answers. O a and care correct answers

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!