fourteen.eight.6 Virtual, sealed, override, and you may abstract accessors

fourteen.eight.6 Virtual, sealed, override, and you may abstract accessors

fourteen.seven.4 Automatically implemented functions

An automatically then followed possessions (or automobile-possessions to possess brief), was a low-abstract, non-extern possessions having semicolon-merely accessor bodies. Auto-qualities will provides a score accessor and could optionally enjoys a great set accessor.

Whenever a house was given because an immediately used assets, a low profile backing field is actually immediately designed for the house, and accessors was followed to learn out-of and you can establish so you’re able to one to backing industry. New undetectable backing job was inaccessible, it could be understand and you can composed simply from the automatically accompanied property accessors, also during the with which has method of. If your vehicles-possessions doesn’t have set accessor, the newest backing profession is recognized as readonly (§fourteen.5.3). Identical to a readonly career, a great getter-only vehicles-possessions could be allotted to in your body from an excellent constructor of your own enclosing group. Such a project assigns to brand new discover-simply backing arena of the home.

fourteen.7.5 The means to access

In the event that a keen accessor enjoys an enthusiastic accessor_modifier, the fresh new entry to website name (§7.5.3) of one’s accessor is determined with the declared use of of accessor_modifier. If an accessor does not have a keen accessor_modifier, this new entry to domain name of your accessor is decided about announced usage of of the home otherwise indexer.

The presence of a keen accessor_modifier never influences user search (§11.5) otherwise overburden resolution (§11.six.4). The modifiers for the property or indexer usually decide which possessions or indexer is likely to, long lasting context of supply.

Shortly after a particular possessions otherwise indexer might have been picked, the new usage of domain names of the specific accessors on it are used to know if you to need holds true:

  • When your usage can be as a respect (§11.dos.2), the latest rating accessor will exist and get obtainable.
  • If for example the utilize is really as the target from an easy task (§.2), the new set accessor should can be found and start to become obtainable.
  • Whether your incorporate can be as the target away from material task (§.3), or as address of ++ otherwise — workers (§eleven.7.14, §eleven.8.6), both the get accessors plus the lay accessor shall exist and be accessible.

Example: On the following the analogy, the house or property A great.Text was hidden by possessions B.Text message , even yet in contexts where only the place accessor is called. On the other hand, the property B.Count isn’t offered to class Meters , so that the accessible possessions Good.Number is utilized instead.

An accessor which is used to make usage of a software shall perhaps not provides a keen accessor_modifier. If perhaps one to accessor is employed to make usage of an interface, the other accessor can be stated with a keen accessor_modifier:

A virtual assets statement determine ohlala your accessors of the house was digital. Brand new virtual modifier applies to all non-private accessors from a property. Whenever an enthusiastic accessor from an online possessions has got the private accessor_modifier, the non-public accessor are implicitly maybe not digital.

A conceptual assets report specifies the accessors of the home are virtual, however, cannot promote an authentic implementation of the fresh new accessors. Alternatively, non-abstract derived kinds are required to promote their own implementation having the fresh new accessors because of the overriding the home. Because the an accessor for an abstract property declaration brings not any execution, its accessor_looks just include an effective semicolon. An abstract property will n’t have an exclusive accessor.

A home report including both abstract and bypass modifiers determine that house is abstract and you can overrides a base possessions. The accessors of such a house are also abstract.

Conceptual property declarations are just enabled for the abstract kinds (§14.dos.dos.2). The fresh new accessors out of an inherited digital possessions will likely be overridden in a great derived category by and a house report one determine an enthusiastic override directive. This will be known as a keen overriding property statement. An overriding property declaration does not declare a separate property. Instead, it really specializes brand new implementations of your accessors away from an existing digital property.