Created
July 14, 2018 08:25
-
-
Save hitendradeveloper/c859a25982d1643eeb052b70a8fe10dd to your computer and use it in GitHub Desktop.
AnyObject + ClassTypes - Example1
This file contains 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
import Foundation | |
//MARK:- Person | |
class Person { | |
var firstName: String = "Hitendra" | |
var lastName: String = "Solanki" | |
}//End: Person | |
//creating instances | objects as a person type | |
let person1: Person = Person() | |
let anyPerson1: AnyObject = person1; //we are storing person as a AnyObject type | |
let anyPerson2: AnyObject = Person(); //we are creating and storing person as a AnyObject type |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment