最新の SDK を使用して iOS アプリケーションを開発しています。
Objective-C++
次の 2 つのプロパティを持つクラスがあります。
@interface MyClass : NSObject
@property (nonatomic) int* road;
@property (nonatomic) int* cars;
...
@end
そしてinit
メソッド内でこれ:
_road = new int[16] (0);
_cars = new int[16] (0);
しかし、私はこのエラーが発生します: Array 'new' cannot have initialization arguments
.
このチュートリアルを読んで、そのように初期化できると彼らは言いました。
これらの変数を初期化するにはどうすればよいですか?