14.eight.six Virtual, closed, bypass, and conceptual accessors

14.eight.six Virtual, closed, bypass, and conceptual accessors

fourteen.seven.cuatro Instantly used qualities

An immediately accompanied property (or vehicles-possessions getting small), try a low-conceptual, non-extern possessions with semicolon-merely accessor bodies. Auto-attributes should have a get accessor that will optionally has a good lay accessor.

Whenever a home try given as the an instantly implemented assets, a hidden support career is automatically designed for the property, therefore the accessors was then followed to see from and you may produce to help you you to support profession. The invisible support career is actually inaccessible, it may be see and you may written merely through the immediately adopted assets accessors, also inside the which includes kind of. Should your automobile-possessions does not have any set accessor, brand new backing career represents readonly (§14.5.3). Just like a readonly occupation, a good getter-just automobile-assets may also be assigned to within the body regarding a constructor of one’s enclosing category. Such as for example an assignment assigns to brand new realize-just support world of the home.

14.seven.5 Use of

If the an enthusiastic accessor keeps an enthusiastic accessor_modifier, brand new access to domain (§7.5.3) of one’s accessor is set using the stated accessibility of the accessor_modifier. If the an enthusiastic accessor doesn’t have an accessor_modifier, the newest the means to access website name of your own accessor is set regarding stated usage of of the house otherwise indexer.

The clear presence of an enthusiastic accessor_modifier never affects user research (§11.5) otherwise overburden solution (§11.six.4). New modifiers towards the possessions or indexer always determine which assets otherwise indexer is bound to, regardless of the perspective of the supply.

Just after a specific assets or indexer could have been chose, the latest the means to access domains of your own certain accessors involved are acclimatized to determine if you to need is true:

  • Whether your utilize is really as an esteem (§eleven.2.2), brand new get accessor will can be found and become accessible.
  • In the event the usage can be as the mark from a simple assignment (§.2), the fresh new lay accessor will occur and start to become accessible.
  • In the event the use can be the mark away from material assignment (§.3), otherwise due to the fact address of one’s ++ or — operators (§eleven.seven.14, §11.8.6), the rating accessors as well as the lay accessor will can be found and you will be around.

Example: Regarding following the analogy recon recenzja, the home A great.Text was invisible by property B.Text message , even yet in contexts where only the set accessor is called. Conversely, the property B.Count isn’t open to group Meters , therefore, the obtainable property Good.Amount can be used as an alternative.

A keen accessor which is used to make usage of a program should perhaps not has actually an enthusiastic accessor_modifier. If perhaps one accessor is utilized to make usage of a program, others accessor are stated which have an accessor_modifier:

An online possessions statement specifies the accessors of the home are digital. Brand new virtual modifier applies to most of the non-private accessors of property. When an enthusiastic accessor from an online assets has got the personal accessor_modifier, the private accessor are implicitly perhaps not digital.

An abstract property statement specifies your accessors of the home was virtual, but will not promote a real utilization of the new accessors. Instead, non-abstract derived kinds are required to bring her implementation to possess this new accessors of the overriding the home. As the an accessor to possess a conceptual possessions declaration brings no actual implementation, its accessor_system simply includes a great semicolon. A conceptual assets should not have a private accessor.

A home report that includes both abstract and override modifiers specifies that the home is conceptual and overrides a base property. The accessors of these a house are also conceptual.

Abstract assets declarations are only let for the conceptual kinds (§fourteen.2.2.2). The brand new accessors off an inherited digital property is overridden inside a derived category by the including a home statement one specifies an enthusiastic override directive. This is certainly known as a keen overriding property statement. An enthusiastic overriding assets report does not state a new assets. As an alternative, it simply specializes the latest implementations of the accessors out-of an existing digital assets.

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *