Last active
February 19, 2019 18:52
-
-
Save keremvatandas/83192f90733c6de578d41ef0e6108b21 to your computer and use it in GitHub Desktop.
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 User { | |
| var name: String | |
| var age: Int | |
| var favProgLang: String | |
| init(name: String, age: Int, favProgLang: String){ | |
| self.name = name | |
| self.age = age | |
| self.favProgLang = favProgLang | |
| } | |
| func display(){ | |
| print("Isim -> \(self.name)\nYas -> \(self.age)\nFavori Programlama Dili -> \(self.favProgLang)") | |
| } | |
| } | |
| var anyType: Any | |
| anyType = User(name: "Kerem", age: 28, favProgLang: "Lisp") | |
| anyType.display() // Value of type 'Any' has no member 'display' | |
| var anyType: Any | |
| anyType = User(name: "Kerem", age: 28, favProgLang: "Lisp") | |
| var res = anyType as! User | |
| res.display() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment