Question: Having class Pointer { int* m_num; public: int* getNum{ return m_num; }; }; Implement a constructor that dynamically holds an integer using m_num and initializes

Having

class Pointer {
 int* m_num; public: int* getNum{ return m_num; 
 }; 
}; 

  1. Implement a constructor that dynamically holds an integer using m_num and initializes it to 5.
  2. Automatically deallocate the dynamic memory when the lifetime of the Pointer class object ends.

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!