Child class override parent class Property (OC), override class propertyoc
Recently, when I was working on a project, I found a problem about @ property, that is, the problem that the subclass overrides the property of the parent class.
The blogger created a project to test the problem. See Figure ‑
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
Subclass rewriting (which may be inappropriate for rewriting) attributes of the parent class. If the compiler does not synthesize underlined attributes, You need to manually synthesize setter and getter. Otherwise, this attribute will be implemented by the parent class, at this time, you should Understand the reason (Understand ?).
Because I wrote the set Method in TC1 (the parent class of TC2 ).
Summary: When we need to override the attributes of the parent class in the subclass (which may be slightly inappropriate in rewriting), it is best to hand-Write the set and get methods in the subclass. Otherwise, you can try again.
PS: I heard that Xcode7 has a warning.