Objective-C++
coutはprintみたいなものかな?メモリを動的に割り当てたいObjective-C++
ヘッダファイルで宣言していたのを修正してコード内で動的にインデックス10のメモリ割り当て。◯bar.h
@interface Hoge { Hoge *hoges[10]; }
◯bar.mm
hoges[0] = new Hoge(0, 0);
今まで↑
◯bar.h
@interface Bar {
Hoge **hoges;
}
◯bar.mm
hoges = (Hoge **)malloc(sizeof(Hoge) * 10); // こうした hoges[0] = new Hoge(0, 0);
今回修正した↑