Hola, ¿necesitas ayuda?

14.7.six Virtual, shut, override, and you may abstract accessors

14.7.six Virtual, shut, override, and you may abstract accessors

fourteen.seven.cuatro Instantly accompanied characteristics

An automatically adopted assets (or auto-possessions to possess small), try a low-conceptual, non-extern assets that have semicolon-merely accessor government. Auto-attributes will has actually a get accessor and can even optionally has an effective lay accessor.

Whenever a property are specified as the an instantly then followed possessions, a low profile backing job is actually instantly available for the home, in addition to accessors try adopted to see out-of and you will build so you can that backing field. Brand new undetectable backing field was unreachable, it can be discover and you may authored simply from instantly implemented property accessors, also in the which has had form of. In case your vehicles-assets has no lay accessor, the brand new support industry represents readonly (§fourteen.5.3). Identical to a readonly job, an effective getter-merely vehicle-assets can be allotted to in your body of a beneficial constructor of your own enclosing classification. Like an assignment assigns directly to the understand-merely support arena of the home.

fourteen.seven.5 Accessibility

If an accessor provides an enthusiastic accessor_modifier, the fresh the means to access website name (§seven.5.3) of your own accessor is determined utilizing the proclaimed access to of accessor_modifier. If an enthusiastic accessor doesn’t have an enthusiastic accessor_modifier, this new use of domain name of the accessor is decided on stated the means to access of the property or indexer.

The presence of a keen accessor_modifier never impacts affiliate lookup (§11.5) or overload solution (§11.six.4). The fresh new modifiers into the assets or indexer constantly figure out which possessions or indexer is likely to, regardless of the framework of your own availability.

Shortly after a specific assets or indexer might have been picked, this new access to domain names of your particular accessors on it are widely used to know if one use is true:

  • If your incorporate is just as an admiration (§11.2.2), the fresh new rating accessor shall can be found and start to become available.
  • In case the need can be as the mark from a straightforward task (§.2), this new set accessor should exist and become available.
  • In the event your usage can be as the prospective away from compound assignment (§.3), otherwise since the address of ++ or — operators (§11.eight.fourteen, §11.8.6), both get accessors therefore the place accessor shall exist and you can be accessible.

Example: On the following the analogy, the house A.Text message try hidden because of the assets B.Text message , even in contexts where just the put accessor is named. In contrast, the home B.Amount is not offered to category Yards , and so the accessible assets A great.Number can be used instead.

A keen accessor that is used to implement a screen shall maybe not has actually an enthusiastic accessor_modifier. Only if that accessor is utilized to apply a program, additional accessor is generally announced with an accessor_modifier:

A virtual possessions report determine the accessors of the house was digital. The new virtual modifier pertains to all of the non-personal accessors out-of a home. Whenever a keen accessor regarding a virtual assets contains the personal accessor_modifier, the personal accessor try implicitly maybe not virtual.

A conceptual property statement specifies the accessors of the house try virtual, but does not offer an authentic utilization of the new accessors. Alternatively, non-conceptual derived classes must provide her implementation to own the latest accessors by overriding the home. Given that an enthusiastic accessor to own a conceptual possessions report will bring no implementation, the accessor_looks only includes a great semicolon. A conceptual property shall n’t have a private accessor.

A property statement complete with both the conceptual and override modifiers specifies your house is conceptual and you can overrides a base property. The accessors of these a home are abstract.

Abstract assets declarations are only let within the abstract kinds (§fourteen.dos.2.2). The accessors from a genetic digital property is going to be overridden within the good derived class from the and additionally a house declaration you to definitely specifies an enthusiastic bypass directive. This is exactly called a keen overriding possessions declaration. An overriding possessions statement cannot declare a special possessions. Instead, it just focuses the new implementations chemistry apk of your own accessors out of an existing digital possessions.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *