Swift in modifying words related to understanding inductive method func

OC recent projects is mixed with Swift, in order to be able to read accessible Swift code, I code when the project will be the definition of the method func find out, found that sometimes there will be some modifications in front of the other keywords func keyword , so to list them all under a unified understanding of:

func

class func

static func

public func

private func

fileprivate func

open func

optional func

public static func

fileprivate static func

override func

overrive class func

overrive open func

open override func

 

Below are some of the information found in these modifiers:

func

Affirming method

 

class func

The method can be overridden

 

static func

Equivalent class final func, prohibited method is overridden

 

open func

public func

fileprivate func

private func

The above modifier is used for access control

 

optional func

Protocol used to modify the definition of an alternative method

 

public static func

fileprivate static func

This is the access restriction can not be overwritten with the effects of combining

 

override func

overrive class func

overrive open func

open override func

Overriding methods. Also open override func estimated that such an approach should be wrong, should override open func.

 

Guess you like

Origin www.cnblogs.com/cchHers/p/12532868.html