在C ++中,除了動態內存分配之外,以下兩行代碼之間是否存在功能差異:Time t (12, 0, 0); //t is a Time objectTime* t = new Time(12, 0, 0);//t is a pointer to a dynamically allocated Time object我當然假設定義了一個Time(int,int,int)ctor。我也意識到在第二種情況下,t將需要刪除,因為它是在堆上分配的。還有其他區別嗎?
使用new與without實例化對象之間的區別是什么
慕無忌1623718
2019-09-19 15:16:51