ios - 重写init方法后,属性声明后为什么不为nil?
PHP中文网
PHP中文网 2017-04-17 17:17:08
0
1
407
PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
黄舟

It seems that you are watching Stanford’s open class. Let me cheer you up first.

From the code you sent, it seems there is nothing wrong.

Check other parts of your code again, focusing on whether when calling the playingCardDeck attribute, self. playingCardDeck, instead of _playingCardDeck, is used.

This method of overriding the attribute getter is called lazy loading. I won’t go into details here about the benefits. What you should note is that the first time you call this attribute, you must use self.xxx instead of _xxx. Because only self.xxx will call the getter method. Therefore, for the sake of safety, it is best to use self.xxx to call all other places except the getter and setter of this property.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!