Question: 2. Given C++ code part below, answer following questions. (8 pts). class B { private: public: }; int main() { B x; } int
2. Given C++ code part below, answer following questions. (8 pts). class B { private: public: }; int main() { B x; } int *p; B() { } ~B() { } By = x; return 0; cout < < "default "; p= new int [8]; cout < < "bye "; delete [] p; 2.2) Is there any error in the code? What is the root cause of the error? 2.3) If you answered "yes" in 2.2), then can you provide solution to fix that error? Please give complete code.
Step by Step Solution
3.44 Rating (157 Votes )
There are 3 Steps involved in it
The image shows a C code snippet with a class B that has a constructor and destructor The constructor allocates an array of integers and the destructo... View full answer
Get step-by-step solutions from verified subject matter experts
