Question: #define _CRT_SECURE_NO_WARNINGS #include using namespace std; class MyInt { int *m_data; public: MyInt(int val){ m_data = new int(val); } ~MyInt() { cout < < deleting:
#define _CRT_SECURE_NO_WARNINGS #include using namespace std;
class MyInt { int *m_data; public: MyInt(int val){ m_data = new int(val); } ~MyInt() { cout << "deleting: " << *m_data << endl; delete m_data; } // Create an assignment operator to set one MyInt to another // and return a reference of the current object
MyInt& operator = ( const MyInt &myint) {
m_data = myint.m_data; if (&myint !=this) { this.m_data = myint.m_data } return *this;
}
// Create an assignment operator to set one MyInt to another // and return a reference of the current object
how do i do this part? i attempted it below..
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
