Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Foundation
- class Ruler{
- var inche:Double{
- get{
- return cm*2.54
- }
- set{
- cm = newValue / 2.54
- }
- }
- var cm:Double = 0.0
- init(cm:Double) {
- self.cm = cm
- }
- init(inche:Double) {
- self.inche = inche
- }
- }
- let num = Ruler(cm : 10)
- print (num.cm)
- print (num.inche)
- print()
- let num1 = Ruler(inche : 25.4)
- print (num1.cm)
- print (num1.inche)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement