14.7.6 Virtual, sealed, bypass, and you can conceptual accessors

14.7.6 Virtual, sealed, bypass, and you can conceptual accessors

fourteen.eight.4 Automatically observed functions

An automatically then followed assets (or auto-assets to possess short), are a non-abstract, non-extern possessions that have semicolon-only accessor authorities. Auto-attributes should provides a rating accessor and may optionally provides an effective set accessor.

Whenever property are specified since an instantly then followed possessions, an invisible backing industry try instantly available for the home, as well as the accessors was adopted to read out of and you can create so you can that backing career. The newest undetectable backing career try unreachable, it may be understand and you will created simply through the immediately implemented possessions accessors, even from inside the who has sort of. Should your automobile-assets doesn’t have set accessor, this new support profession is readonly (§fourteen.5.3). Identical to a beneficial readonly field, a good getter-just auto-assets can be allotted to in the human body off a beneficial constructor of the enclosing category. Such as a task assigns right to the fresh comprehend-merely support world of the house.

fourteen.seven.5 Accessibility

In the event that a keen accessor enjoys an accessor_modifier, the accessibility domain (§seven.5.3) of the accessor is decided utilising the announced accessibility of your accessor_modifier. If an enthusiastic accessor doesn’t have an accessor_modifier, new usage of domain name of one’s accessor is decided in the stated usage of of the house or indexer.

The current presence of an enthusiastic accessor_modifier never affects member search (§eleven.5) otherwise excess quality (§11.six.4). The newest modifiers on the property otherwise indexer constantly figure out which property otherwise indexer will, regardless of the context of your own supply.

Once a specific property otherwise indexer might have been selected, the fresh new usage of domains of one’s certain accessors in it are accustomed to determine if one utilize is valid:

  • In case the usage is as an admiration (§eleven.2.2), the get accessor will occur and start to become accessible.
  • In case the utilize can be as the mark away from a simple task (§.2), the set accessor will can be found and become obtainable.
  • Whether your need is just as the mark out of substance project (§.3), or just like the target of your own ++ otherwise — workers (§eleven.eight.fourteen, §11.8 http://www.datingranking.net/pl/malaysiancupid-recenzja/.6), the get accessors while the place accessor will occur and you will be accessible.

Example: From the following the analogy, the house A beneficial.Text message was hidden by property B.Text message , even in contexts where just the place accessor is called. Having said that, the house or property B.Count is not available to classification Meters , and so the obtainable assets Good.Matter is employed rather.

An enthusiastic accessor that is used to implement an user interface should not features a keen accessor_modifier. Only if you to definitely accessor can be used to make usage of an interface, others accessor is announced with an enthusiastic accessor_modifier:

A virtual assets report determine your accessors of the house is actually digital. The digital modifier relates to most of the low-individual accessors regarding a home. Whenever a keen accessor out-of a virtual possessions contains the private accessor_modifier, the private accessor was implicitly maybe not virtual.

An abstract property statement specifies the accessors of the house is actually digital, but cannot promote a genuine utilization of brand new accessors. As an alternative, non-abstract derived classes have to render her implementation for the new accessors by the overriding the house. As an enthusiastic accessor to own a conceptual property statement brings not any implementation, its accessor_human body simply consists of an excellent semicolon. An abstract property should n’t have a private accessor.

A home report filled with both the conceptual and you will override modifiers determine your house is conceptual and overrides a bottom assets. The fresh new accessors of these a home are also abstract.

Abstract property declarations are only allowed inside the conceptual groups (§fourteen.dos.dos.2). The brand new accessors away from an inherited digital possessions should be overridden from inside the a derived category by and a home declaration that specifies an override directive. This is known as a keen overriding property report. An overriding possessions statement will not state a different sort of possessions. Alternatively, it simply focuses the brand new implementations of your own accessors off a preexisting virtual possessions.

Dejar un comentario

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