دسته‌بندی نشده

fourteen.seven.six Digital, shut, override, and you may abstract accessors

fourteen.seven.six Digital, shut, override, and you may abstract accessors

fourteen.seven.4 Automatically implemented characteristics

An instantly followed https://datingranking.net/pl/tagged-recenzja/ possessions (otherwise vehicle-assets getting brief), is a non-conceptual, non-extern possessions which have semicolon-only accessor government. Auto-characteristics will features a get accessor and could optionally possess an effective place accessor.

When a house was specified since an immediately implemented assets, a hidden support job try automatically designed for the home, while the accessors is implemented to learn out-of and you will create so you can that support profession. The newest undetectable backing community was inaccessible, it could be read and you will created simply from instantly used possessions accessors, also inside the that has sort of. Should your car-property has no place accessor, new backing profession is readonly (§14.5.3). Just like a great readonly job, good getter-merely automobile-property could be assigned to in the body out of good constructor of enclosing classification. Eg an assignment assigns straight to brand new understand-just backing field of the property.

fourteen.seven.5 Access to

When the an enthusiastic accessor possess an enthusiastic accessor_modifier, brand new the means to access domain name (§seven.5.3) of your accessor is determined utilizing the declared accessibility of accessor_modifier. In the event the a keen accessor doesn’t always have an accessor_modifier, the fresh new the means to access domain name of your accessor is determined on stated access to of the home otherwise indexer.

The current presence of an enthusiastic accessor_modifier never impacts representative lookup (§eleven.5) or overload quality (§eleven.6.4). This new modifiers toward property otherwise indexer usually determine which possessions or indexer is likely to, regardless of the context of your availability.

Once a specific property or indexer could have been picked, new entry to domains of one’s particular accessors on it are used to determine if one to incorporate holds true:

  • In case the incorporate can be a respect (§eleven.dos.2), the latest rating accessor shall can be found and be accessible.
  • In the event the usage can be as the target away from a straightforward task (§.2), this new set accessor shall exists and become accessible.
  • In case your utilize is as the goal away from material task (§.3), or just like the target of one’s ++ or — workers (§11.eight.fourteen, §11.8.6), the get accessors therefore the set accessor should exist and you can be around.

Example: On adopting the analogy, the property A good.Text was hidden from the possessions B.Text , inside contexts in which precisely the place accessor is named. Alternatively, the house B.Matter isn’t accessible to class Meters , and so the accessible property An excellent.Count can be used as an alternative.

An enthusiastic accessor that is used to implement a screen should perhaps not provides a keen accessor_modifier. Only if you to accessor is utilized to make usage of a software, additional accessor tends to be stated having a keen accessor_modifier:

A virtual possessions declaration specifies the accessors of the property is virtual. This new virtual modifier pertains to most of the non-individual accessors regarding a property. When a keen accessor of an online assets has the individual accessor_modifier, the personal accessor was implicitly perhaps not digital.

An abstract possessions declaration determine the accessors of the house is actually virtual, but doesn’t render an actual implementation of new accessors. Alternatively, non-conceptual derived kinds must promote their execution getting brand new accessors because of the overriding the house. Just like the an accessor to have an abstract assets declaration will bring no actual execution, its accessor_human body just consists of a good semicolon. An abstract possessions will not have a private accessor.

A home statement filled with both the conceptual and you can bypass modifiers specifies your home is abstract and you can overrides a base assets. The brand new accessors of these a property also are conceptual.

Conceptual assets declarations are only allowed inside the conceptual categories (§fourteen.dos.2.2). New accessors from a genetic virtual possessions will likely be overridden inside a derived classification from the as well as a property statement you to definitely specifies an override directive. It is also known as an enthusiastic overriding property declaration. An enthusiastic overriding possessions declaration does not claim a different assets. Rather, it simply specializes this new implementations of the accessors from an existing digital possessions.

دیدگاهتان را بنویسید