printf("*pInt = %d\r\n", *pInt);
}
15、写出下面程序的结果
class A
{
public:
A()
{
m_pData = NULL;
}
A(LPSTR p)
{
int n = strlen(p);
m_pData = new char[n+1];
memset(m_pData, 0, n+1);
memcpy(m_pData, p, n);
printf("Data=%d,Len =%d\n", m_pData, n);
}
~A()
{
delete[] m_pData;
}
private:
char * m_pData;
}
void main()
{
A* pObj1 = new A("ABC");
A* pObj2 = pObj1;
A aObj1("DEF");
A aObj2=aObj1;
delete pObj2;
}
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/