Computed read-only property vs function in Swift

后端 未结 10 914
忘了有多久
忘了有多久 2020-12-04 11:00

In the Introduction to Swift WWDC session, a read-only property description is demonstrated:

class Vehicle {
    var numberOfWheels = 0
    var          


        
10条回答
  •  [愿得一人]
    2020-12-04 11:08

    There is a difference: If you use a property you can then eventually override it and make it read/write in a subclass.

提交回复
热议问题