0

classes vs structures and initialization

Why is it that u have to set properties to some value in classes when u define the class, but when u define a structure all u have to do is initialize the property and not set a start state?

5th May 2017, 7:02 PM
FishermanMan
1 Answer
0
This is because for structs, you get an automatic member wise initialiser; whilst for classes you need to define all your properties as optional, or manually create an initialiser. Hope this helps, Pawel
12th Jun 2021, 1:44 PM
Pawel Zabinski
Pawel Zabinski - avatar