Created
November 3, 2014 06:26
-
-
Save Ryusuke-Kawasaki/a40e1d0f7df6060cda5e to your computer and use it in GitHub Desktop.
property7.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Person{ | |
| ... | |
| var isAdult:Bool{ | |
| return (age >= 20) | |
| } | |
| ... | |
| } | |
| var person = Person(firstName: "Hanako", lastName: "Sakura") | |
| person.age = 15 | |
| println(person.isAdult) | |
| person.age = 30 | |
| println(person.isAdult) | |
| //結果 | |
| //false | |
| //true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment