14.7.six Virtual, closed, override, and you will conceptual accessors

14.7.six Virtual, closed, override, and you will conceptual accessors

fourteen.eight.4 Instantly implemented characteristics

An immediately implemented assets (otherwise car-property for small), is actually a low-conceptual, non-extern assets that have semicolon-only accessor regulators. Auto-services shall possess a rating accessor and can even optionally has actually an excellent place accessor.

When a house try specified because an instantly accompanied assets, an invisible backing profession is immediately available for the home, therefore the accessors try used to learn away from and develop so you can you to definitely backing job. This new undetectable support job try inaccessible, it may be see and you may composed simply through the immediately adopted property accessors, actually for the which has had kind of www.datingranking.net/tr/lumen-dating-inceleme/. In the event the vehicles-assets does not have any lay accessor, the new backing occupation is considered readonly (§fourteen.5.3). Identical to a great readonly community, an effective getter-simply vehicles-assets can be assigned to in the body of good constructor of enclosing class. Such as for example an assignment assigns right to new read-only backing field of the home.

14.eight.5 Accessibility

In the event the an accessor keeps an accessor_modifier, the new use of website name (§seven.5.3) of your own accessor is determined by using the proclaimed use of of one’s accessor_modifier. When the a keen accessor does not have an accessor_modifier, the latest access to domain of accessor is set about proclaimed entry to of the property or indexer.

The existence of an accessor_modifier never ever influences user look (§11.5) or overburden resolution (§11.6.4). The brand new modifiers on property otherwise indexer usually determine which property or indexer can be sure to, whatever the framework of the availableness.

Shortly after a certain property or indexer has been chose, the latest usage of domains of the certain accessors inside it are accustomed to determine if one incorporate is true:

  • When your use is just as an esteem (§11.dos.2), the newest score accessor shall occur and start to become accessible.
  • In case the usage is really as the prospective out of an easy task (§.2), the newest set accessor should can be found and stay accessible.
  • In case the usage can be the prospective out of material project (§.3), otherwise once the target of the ++ otherwise — providers (§11.eight.14, §11.8.6), both score accessors while the place accessor will can be found and you will be around.

Example: Regarding the pursuing the analogy, the home A.Text was hidden by assets B.Text , inside contexts in which only the lay accessor is named. However, the house or property B.Matter is not offered to group M , and so the obtainable assets An excellent.Amount is employed instead.

A keen accessor which is used to apply a software will maybe not has actually a keen accessor_modifier. If perhaps you to accessor can be used to apply a program, additional accessor could be announced having a keen accessor_modifier:

A virtual property statement determine your accessors of the house is actually digital. The brand new virtual modifier applies to all of the non-private accessors of a house. Whenever an accessor out of a virtual possessions has got the personal accessor_modifier, the personal accessor is actually implicitly perhaps not virtual.

An abstract assets report specifies the accessors of the home is digital, however, cannot offer an actual utilization of the newest accessors. As an alternative, non-conceptual derived classes must render their execution getting the fresh accessors by overriding the home. Due to the fact an enthusiastic accessor to possess a conceptual property statement brings no implementation, the accessor_muscles merely include an effective semicolon. An abstract possessions shall n’t have a personal accessor.

A house declaration filled with both the conceptual and you may bypass modifiers specifies that the home is conceptual and you will overrides a base assets. The new accessors of these a property are conceptual.

Conceptual property declarations are merely enabled for the abstract categories (§14.2.dos.2). The brand new accessors out of an inherited digital possessions is going to be overridden from inside the an excellent derived class by along with a home statement one to specifies an enthusiastic bypass directive. This is known as an overriding possessions declaration. A keen overriding assets declaration cannot declare a special possessions. As an alternative, it really specializes the new implementations of your accessors out-of an existing virtual possessions.

Dejar un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *