fourteen.eight.six Virtual, sealed, override, and you can conceptual accessors

Jun 2, 2022 0 Comments in Love Ru visitors by

fourteen.eight.six Virtual, sealed, override, and you can conceptual accessors

14.7.4 Immediately accompanied qualities

An instantly observed property (otherwise vehicles-assets getting small), is a non-abstract, non-extern possessions which have semicolon-simply accessor bodies. Auto-services should features a rating accessor and may optionally have good put accessor.

When a property is specified while the an automatically followed assets, a low profile support occupation was immediately available for the property, plus the accessors is actually used to read through off and you will establish so you can one backing field. This new undetectable backing community are unreachable, it could be read and you can authored only from instantly accompanied assets accessors, even within the which has method of. In case the vehicles-assets doesn’t have set accessor, the fresh support industry is considered readonly (§fourteen.5.3). Just like good readonly career, a beneficial getter-merely vehicle-assets could be allotted to in the torso out of a good constructor of your own enclosing class. For example a task assigns straight to brand new discover-merely backing field of the house or property.

fourteen.eight.5 Accessibility

When the a keen accessor have an accessor_modifier, the newest entry to domain (§7.5.3) of the accessor is decided with the proclaimed use of of one’s accessor_modifier. In the event that a keen accessor does not have a keen accessor_modifier, the the means to access website name of accessor is determined from the proclaimed entry to of the property otherwise indexer.

The clear presence of an accessor_modifier never ever has an effect on associate look (§11.5) otherwise overburden quality (§11.6.4). The newest modifiers to the possessions otherwise indexer always decide which possessions otherwise indexer can be sure to, no matter what context of your own supply.

Immediately following a particular possessions or indexer could have been chose, this new accessibility domains of certain accessors with it are accustomed to determine if one usage holds true:

  • In case the need is just as an esteem (§eleven.dos.2), the new rating accessor should are present and start to become obtainable.
  • If the incorporate can be as the target out-of an easy project (§.2), the brand new set accessor will occur and start to become available.
  • If your use can be the target off compound assignment (§.3), or because address of the ++ or — providers (§11.seven.fourteen, §11.8.6), both the rating accessors additionally the set accessor shall can be found and you will be around.

Example: On after the example, the property A great.Text message is hidden of the property B.Text message , even in contexts where only the place accessor is named. In contrast, the house B.Number isn’t accessible to class Yards , and so the available assets A great.Number love ru desktop is utilized rather.

An accessor which is used to make usage of a software should perhaps not features a keen accessor_modifier. If only that accessor is utilized to apply an user interface, the other accessor can be announced which have an accessor_modifier:

An online possessions statement specifies your accessors of the home are virtual. The latest virtual modifier pertains to every non-private accessors away from a house. When an enthusiastic accessor away from an online assets has got the individual accessor_modifier, the personal accessor try implicitly perhaps not digital.

A conceptual assets report determine your accessors of the property try digital, however, doesn’t provide an authentic implementation of the accessors. Rather, non-conceptual derived categories must render their unique execution to have brand new accessors by overriding the house. While the an accessor to own an abstract assets report provides no execution, its accessor_body only contains an effective semicolon. An abstract property shall not have a private accessor.

Property declaration complete with the conceptual and you will override modifiers determine the home is conceptual and you may overrides a bottom assets. The accessors of these property are abstract.

Abstract assets declarations are merely allowed into the conceptual classes (§14.2.2.2). Brand new accessors away from an inherited virtual possessions is overridden within the a great derived group of the and property declaration you to definitely specifies an bypass directive. This is also known as an enthusiastic overriding assets statement. An overriding possessions report cannot claim another type of assets. Instead, it just specializes the latest implementations of your own accessors away from an existing virtual property.