THỨ TƯ,NGÀY 22 THÁNG 4, 2020

fourteen.8.5 Virtual, sealed, override, and abstract accessors

Bởi Nguyễn Hoàng Phong

Cập nhật: 05/06/2022, 03:05

fourteen.8.5 Virtual, sealed, override, and abstract accessors

Whenever an event declaration includes a fixed modifier, case is claimed are a fixed feel. When zero static modifier can be acquired, the event is claimed becoming an instance feel.

A fixed feel is not regarding the a particular including, and is an amass-date error to refer to that on the accessors out of a beneficial fixed experiences.

An instance knowledge try associated with the a given exemplory instance of good group, hence such as for instance might be reached as this (§eleven.eight.12) from the accessors of that skills.

A virtual experiences report determine the accessors of the knowledge try virtual. The latest virtual modifier applies to one another accessors of a conference.

An abstract feel report specifies your accessors of knowledge is actually digital, but will not promote an authentic utilization of the newest accessors. Alternatively, non-conceptual derived kinds are required to promote their implementation to possess the accessors of the overriding the function. Since an enthusiastic accessor to have a conceptual experiences statement provides no actual execution, they should not render event_accessor_declarations.

A meeting statement including both the conceptual and you may override modifiers determine that the knowledge is actually abstract and you will overrides a base enjoy. The fresh new accessors of these an event also are abstract.

The fresh accessors out-of a genetic digital experience are going to be overridden within the a great derived class because of the together with a meeting declaration you to definitely specifies an override modifier. This can be also known as a keen overriding knowledge report. Alternatively, it really focuses the fresh implementations of your own accessors from an existing virtual experience.

An overriding experience e entry to modifiers and you may name as the overridden experience, here are going to be an identification transformation within sorts of this new overriding therefore the overridden event, and you will both create and take away accessors is going to be given within the fresh report.

An enthusiastic overriding knowledge report range from the sealed modifier. Access to it modifier suppresses a derived class regarding then overriding the function. The new accessors from a closed skills also are close.

Except for variations in report and invocation syntax, digital, close, bypass, and you may abstract accessors behave exactly like virtual, shut, override and abstract methods. Particularly, the rules described for the §14.6.cuatro, §14.six.5, §fourteen.6.6, and §14.6.eight use as if accessors was types of a corresponding mode. For each and every accessor corresponds to a method which have one well worth factor of the knowledge form of, a gap come back type of, additionally the same modifiers just like the which has had skills.

fourteen.nine Indexers

A keen indexer was an associate that enables an item to-be indexed by exactly the same way given that a selection. Indexers try stated using indexer_declarations:

An enthusiastic indexer_statement vary from a set of qualities (§21) and a valid mixture of the fresh five availability modifiers (§14.step 3.6), the new (§fourteen.step 3.5), virtual (§fourteen.six.4), override (§14.six.5), close (§fourteen.6.6), conceptual (§14.six.7), and you can extern (§fourteen.six.8) modifiers.

Indexer age legislation once the strategy declarations (§fourteen.6) for good combinations out-of modifiers, on the you to definitely exception to this rule becoming the static modifier is not enabled into the a paltalk keen indexer declaration.

Brand new modifiers digital , override , and you may conceptual try mutually exclusive except in one circumstances. The brand new conceptual and override modifiers can be utilized with her making sure that an abstract indexer is also bypass an online one.

A keen overriding experience statement does not declare yet another experience

Note: Due to the fact indexers are made to be taken inside number ability-for example contexts, the definition of ability form of just like the laid out getting a wide range is also used with a keen indexer. avoid note

Unless the latest indexer is actually a specific interface user implementation, the kind is accompanied by the fresh key phrase that it . Getting a direct screen affiliate implementation, the kind is actually accompanied by a program_types of, a ” . “, additionally the keyword so it . In lieu of most other participants, indexers lack member-discussed names.

Bình luận

Tôn trọng lẫn nhau, hãy giữ cuộc tranh luận một cách văn minh và không đi vượt quá chủ đề chính. Thoải mái được chỉ trích ý kiến nhưng không được chỉ trích cá nhân. Chúng tôi sẽ xóa bình luận nếu nó vi phạm Nguyên tắc cộng đồng của chúng tôi

Chưa có bình luận. Sao bạn không là người đầu tiên bình luận nhỉ?

SEARCH