@property not available for classes?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 4 07:09:52 PST 2016


On 1/3/16 2:25 PM, Jacob Carlborg wrote:
> On 2016-01-03 18:48, Steven Schveighoffer wrote:
>
>> class constructor requirements are much different from struct
>> constructor requirements. There's also no implicit constructor that
>> initializes all members as there is for structs.
>
> To clarify, there's a default (implicit) constructor that initializes
> all members to what they are set to in the class declaration. But you
> cannot pass in any arguments to the default constructor. Hmm,
> technically that might actually not be the constructor that initializes
> the members, not sure.
>

Technically, the GC initializes the data as given by the TypeInfo before 
the ctor is run. I believe the default ctor does nothing, not even sure 
if it exists or is called. For simplicity, you can assume there is one.

But yes, I was referring to the struct ctor that allows you to 
initialize one or more of the members to non-default values.

-Steve


More information about the Digitalmars-d-learn mailing list