14.7.6 Digital, sealed, bypass, and you will conceptual accessors

14.seven.4 Instantly followed services

An instantly used possessions (otherwise automobile-property to own brief), are a low-abstract, non-extern assets that have semicolon-merely accessor bodies. Auto-attributes shall enjoys a score accessor and may optionally have good lay accessor.

When a house try specified while the an automatically used possessions, a hidden support field is automatically readily available for the house, additionally the accessors try followed to read through regarding and you may create in order to that support field. New invisible backing community is inaccessible, it can be read and you will written just from the automatically adopted property accessors, also when you look at the with form of. In case your vehicle-assets doesn’t have place accessor, the support career is readonly (§14.5.3). Just like good readonly field, a getter-merely vehicle-property could be assigned to in the torso out-of a good constructor of enclosing group. Particularly a task assigns right to the see-merely backing world of the property.

fourteen.7.5 Use of

When the an accessor features an enthusiastic accessor_modifier, the new usage of domain name (§eight.5.3) of your accessor is decided by using the announced accessibility of your own accessor_modifier. In the event that an accessor does not have an enthusiastic accessor_modifier, the newest access to website name of one’s accessor is set in the announced access to of the property or indexer.

The existence of a keen accessor_modifier never affects user lookup (§11.5) otherwise overburden resolution (§11.six.4). The modifiers towards the possessions or indexer always decide which possessions otherwise indexer will, whatever the framework of your own access.

Just after a particular assets otherwise indexer could have been chosen, brand new entry to domain names of the certain accessors in it are widely used to determine if one need holds true:

  • Should your utilize is just as a value (§eleven.2.2), the fresh new get accessor shall exist and become accessible.
  • If for example the usage is just as the goal out-of a simple task (§.2), this new set accessor will can be found and start to become accessible.
  • Whether your utilize can be the goal out-of compound assignment (§.3), or while the target of ++ otherwise — providers (§eleven.eight.fourteen, §eleven.8.6), both the rating accessors additionally the set accessor shall can be found and you can be nazwa użytkownika paltalk available.

Example: From the after the example, the property An excellent.Text is actually undetectable by property B.Text message , inside contexts in which only the put accessor is named. Having said that, the house B.Number is not accessible to class M , and so the accessible possessions A great.Amount is used instead.

An accessor that is used to make usage of a program will perhaps not features an accessor_modifier. Only if that accessor can be used to make usage of a program, additional accessor is declared that have a keen accessor_modifier:

A virtual possessions statement determine your accessors of the house is actually digital. Brand new virtual modifier pertains to all low-individual accessors regarding a property. Whenever a keen accessor regarding a virtual property has the individual accessor_modifier, the non-public accessor are implicitly perhaps not virtual.

An abstract property declaration specifies that accessors of the property is digital, however, cannot render a genuine implementation of the fresh accessors. Rather, non-abstract derived categories have to render their implementation to have the brand new accessors by the overriding the house. Because an accessor to possess a conceptual assets statement provides not any implementation, its accessor_system merely includes good semicolon. A conceptual property will n’t have an exclusive accessor.

A house declaration detailed with the conceptual and you may bypass modifiers specifies the home is conceptual and overrides a bottom property. This new accessors of such a property are conceptual.

Abstract property declarations are only allowed from inside the abstract groups (§14.dos.2.2). The fresh new accessors of a hereditary digital property are overridden when you look at the a beneficial derived category from the in addition to a property report one to determine an override directive. This will be also known as an enthusiastic overriding property statement. An overriding possessions declaration does not claim a different sort of property. Rather, it really specializes the fresh new implementations of the accessors out of a preexisting digital assets.