Preventing overrides

To prevent overrides or subclassing, we can use the final keyword. To use the final keyword, we add it before the item's definition. Examples are final func, final var, and final class.

Any attempt to override an item marked with this keyword will result in a compile-time error.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset