#include <cstring>
class MyClass {
public:
MyClass(char* str) {
// Allocate memory for the char pointer
m_str = new char[strlen(str) + 1];
// Copy the input string to the allocated memory
strcpy(m_str, str);
}
// Destructor to free the allocated memory
~MyClass() {
delete[] m_str;
}
private:
char* m_str;
};