pxxfxxxxx

导航

C++封装篇(下)

5.0 对象数组

 

int main(void)
{
    Coordinate coord[3]; //栈中实例化
    coord[1].m_ix = 10;
    Coordinate* p = new Coordinate[3];//堆中实例化对象
    p[0].m_iY = 20; //p->m_iY = 20;
    delete[]p;
    p = NULL;
    return 0;
}

 

posted on 2019-06-21 16:41  pxxfxxxxx  阅读(122)  评论(0编辑  收藏  举报