swift - Computed properties cannot store a value but hold a value, what is hold and how to hold? -


quote "swift apprentice second edition page 225":

properties(computed) hold values can , set. methods perform work

quote "swift official document":

in addition stored properties, classes, structures, , enumerations can define computed properties, not store value

one says "store", 1 says "hold". bit confused computed properties, computed properties not store value means? means system not assign memory space save value , hold it. what's hold means? can't hold in nowhere, need maybe box hold something, isn't it?

simple example documentation

struct cuboid {     var width = 0.0, height = 0.0, depth = 0.0     var volume: double {         return width * height * depth     } } 

volume never stored in memory. whenever getter called result of multiplication returned dynamically math operation in local scope.

the official apple documentation not use term hold @ all.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -