inheritance - Swift superclass property/method access: self vs super -


in swift, seems superclass's property or method can accessed through both self , super without compile issue.

i know when need override superclass's property or method, mandatory use super disambiguate.

but when want access shared method superclass, 1 more appropriate?

i tend prefer super since think makes more readable code not sure best practice is.

thank you!

if method overridden,then self can used access method in subclass otherwise accessing method of super class base class best practice use super.


Comments