blk-inceleme visitors

14.seven.six Virtual, shut, override, and you will abstract accessors

14.seven.six Virtual, shut, override, and you will abstract accessors

fourteen.eight.4 Instantly used features

An immediately used assets (or auto-property for quick), is actually a non-abstract, non-extern property that have semicolon-only accessor authorities. Auto-functions shall has a get accessor and may optionally enjoys an effective set accessor.

Whenever a property try specified since the an instantly implemented assets, a hidden support job try immediately designed for the house, therefore the accessors are adopted to learn regarding and you will create to help you you to definitely backing community. This new hidden support industry try inaccessible, it can be comprehend and you will composed only from the immediately implemented assets accessors, even for the that has had type. Should your vehicle-property does not have any put accessor, the newest support field is considered readonly (§fourteen.5.3). Just like a good readonly community, a beneficial getter-just automobile-possessions may also be assigned to in the body away from a constructor of one’s enclosing class. Such as a project assigns straight to the fresh read-simply backing arena of the http://datingranking.net/tr/blk-inceleme house.

fourteen.seven.5 The means to access

In the event the an enthusiastic accessor have a keen accessor_modifier, new the means to access domain name (§eight.5.3) of accessor is decided utilizing the stated the means to access of the accessor_modifier. If the a keen accessor does not have an accessor_modifier, brand new accessibility domain name of your accessor is set regarding proclaimed usage of of the house or indexer.

The existence of a keen accessor_modifier never impacts user lookup (§11.5) or excess quality (§eleven.six.4). The fresh new modifiers on the property or indexer always determine which property otherwise indexer will, whatever the context of availability.

Immediately after a particular assets otherwise indexer has been selected, the newest usage of domain names of the certain accessors inside it are widely used to know if one to need is valid:

  • In case your incorporate is really as a regard (§eleven.2.2), the latest score accessor shall occur and start to become available.
  • In case the usage is as the mark from a straightforward task (§.2), the fresh new put accessor should can be found and be obtainable.
  • If for example the incorporate can be as the prospective out of compound project (§.3), or just like the target of one’s ++ or — workers (§11.eight.fourteen, §11.8.6), the get accessors plus the set accessor should can be found and be accessible.

Example: About pursuing the example, the house An excellent.Text try invisible by the property B.Text message , even yet in contexts where only the set accessor is named. Alternatively, the house or property B.Number is not available to classification Yards , therefore, the accessible possessions A beneficial.Number is employed alternatively.

An accessor that is used to make usage of a program shall not has an enthusiastic accessor_modifier. If perhaps you to definitely accessor can be used to implement a program, the other accessor is generally announced with an accessor_modifier:

An online property declaration specifies your accessors of the home try virtual. New digital modifier relates to all low-personal accessors of a property. Whenever an accessor from a virtual assets comes with the private accessor_modifier, the non-public accessor is actually implicitly not virtual.

A conceptual possessions report specifies that the accessors of the home is actually digital, however, cannot bring a genuine utilization of the newest accessors. Rather, non-abstract derived categories must promote her execution having the new accessors because of the overriding the house. Since a keen accessor having a conceptual property report provides no actual implementation, their accessor_looks only consists of good semicolon. An abstract property will n’t have an exclusive accessor.

A home declaration that includes both the abstract and you may bypass modifiers specifies the house is abstract and you can overrides a base property. Brand new accessors of these property are also conceptual.

Conceptual assets declarations are merely permitted during the conceptual categories (§14.2.dos.2). This new accessors away from a genetic digital assets is going to be overridden when you look at the a beneficial derived category because of the along with a property report one to determine an override directive. This is exactly called an enthusiastic overriding assets declaration. An overriding possessions statement cannot claim another assets. Alternatively, it simply specializes the brand new implementations of accessors off a preexisting digital property.