Instantiate an array of objects, in simpliest way?

后端 未结 3 2213
傲寒
傲寒 2020-12-18 11:28

Given a class:

class clsPerson { public int x, y; }

Is there some way to create an array of these classes with each element initialized to

3条回答
  •  [愿得一人]
    2020-12-18 12:12

    If it would make sense to do so, you could change class clsPerson to struct Person. structs always have a default value.

提交回复
热议问题