fourteen.seven.4 Instantly accompanied characteristics
An immediately followed assets (or car-property to have brief), are a non-abstract, non-extern assets with semicolon-merely accessor government. Auto-features shall keeps a get accessor and will optionally keeps good place accessor.
Whenever a mocospace property is actually given since the an instantly then followed assets, an invisible backing career is actually automatically designed for the property, and also the accessors are accompanied to see away from and you can generate in order to one to support industry. The fresh new invisible support industry is inaccessible, it can be read and you may authored only from immediately then followed possessions accessors, also from inside the that has had type of. Whether your car-property does not have any place accessor, the newest support career is recognized as readonly (§14.5.3). Same as a beneficial readonly field, a beneficial getter-simply car-property may also be allotted to in the body regarding an excellent constructor of your own enclosing category. Like an assignment assigns directly to brand new read-simply backing arena of the house or property.
14.seven.5 Usage of
If the an enthusiastic accessor has a keen accessor_modifier, the fresh new use of domain (§seven.5.3) of one’s accessor is set using the announced access to of accessor_modifier. In the event the an enthusiastic accessor doesn’t have an accessor_modifier, the fresh new entry to website name of your accessor is decided regarding the stated the means to access of the home otherwise indexer.
The presence of an enthusiastic accessor_modifier never has an effect on user lookup (§11.5) or overload resolution (§11.six.4). This new modifiers into possessions otherwise indexer always determine which possessions or indexer can be sure to, long lasting context of your supply.
Once a specific possessions or indexer might have been picked, this new use of domain names of your certain accessors with it are accustomed to determine if that need holds true:
- Should your use is as an admiration (§11.2.2), the fresh new get accessor shall exist and be available.
- When your utilize is really as the target off a simple task (§.2), the brand new set accessor will can be found and be available.
- In the event the incorporate is as the goal off material project (§.3), otherwise as the address of one’s ++ or — workers (§11.seven.14, §eleven.8.6), both score accessors while the place accessor will are present and you will be around.
Example: Throughout the after the analogy, the house or property A great.Text was undetectable from the assets B.Text message , in contexts in which precisely the put accessor is called. Conversely, the home B.Count isn’t accessible to classification Yards , so that the accessible property A great.Count can be used rather.
A keen accessor that is used to apply an interface should not have an accessor_modifier. Only if one to accessor is utilized to implement a software, another accessor tends to be declared which have an accessor_modifier:
An online property report specifies the accessors of the home are virtual. The latest virtual modifier applies to most of the low-individual accessors away from property. When a keen accessor regarding an online possessions has got the private accessor_modifier, the personal accessor try implicitly maybe not digital.
A conceptual assets declaration specifies that accessors of the home try digital, however, does not give a real implementation of the fresh accessors. Rather, non-conceptual derived categories have to give their unique execution getting new accessors because of the overriding the house or property. While the an enthusiastic accessor having an abstract property declaration brings no actual execution, the accessor_human anatomy just includes a semicolon. A conceptual assets shall n’t have an exclusive accessor.
A home declaration detailed with both abstract and you may bypass modifiers determine that property is conceptual and overrides a bottom assets. The newest accessors of such a property are abstract.
Conceptual property declarations are just allowed into the abstract kinds (§14.dos.dos.2). The fresh new accessors out-of a hereditary digital assets will likely be overridden for the an effective derived group from the including a home report you to determine an enthusiastic override directive. This can be called an overriding assets statement. A keen overriding possessions declaration does not declare an alternative possessions. Instead, it simply specializes the fresh implementations of the accessors out of a preexisting virtual assets.