ã³ã³ãã¥ã¼ãããã»ããããã£ï¼Computed Propertyï¼ã使ãã ã³ã³ãã¥ã¼ãããã»ããããã£ï¼Computed Propertyï¼ã¯ ã²ãã¿ã¼ã¡ã½ããã¨ã»ãã¿ã¼ã¡ã½ããã¨å¼ã°ããï¼ã¤ã®ã¡ã½ãããæä¾ããããããã£ã®ãã¨ã 使ãæ¹ã®ä¾ Itemã¯ã©ã¹ã«priceï¼ç¨æãä¾¡æ ¼ï¼ã¨intaxPrice(ç¨è¾¼ã¿ä¾¡æ ¼)ãããã¾ãã intaxPriceãComputedããããã£ã¨ãªã£ã¦ããã intaxPriceãåå¾ããéã«getã¡ã½ãããå¼ã°ãã å¤ãã»ããããéã«ãsetã¡ã½ãããå¼ã°ãã¾ãã class Item { // ç¨æãä¾¡æ ¼ var price:Double = 0 // ç¨è¾¼ã¿ä¾¡æ ¼ var intaxPrice:Double { // å¤ãåå¾ããã¨ãã«å¼ã°ããã get{ return self.price*1.08 } // å¤ãã»ãããããã¨ãã«å¼ã°ããã s
{{#tags}}- {{label}}
{{/tags}}