title: Change variable to subclass in Swift
body: <p>In Swift if I have a base class and two classes that inherit from it that have their own properties. If I assign a variable to the base class then later change it to the subclass, I can't access said properties. Here is a really dumb example. It's what I could think of in a pinch.
  <a href="http://swiftstub.com/927736954/?v=gm" rel="noreferrer">http://swiftstub.com/927736954/?v=gm</a></p>
  
  <pre><code>class Animal {
      let alive = true
  }
  
  class Human:Animal {
      let socks:Int = 5
  }
  
  class Dog:Animal {
      let collar = "fun"
  }
  
  var a:Animal!
  
  var letter = "h"
  
  switch letter {
      case "d":
          a = Dog()
      case "h":
          a = Human()
      default:
          a = Animal()
  }
  
  print(a is Human) // TRUE
  print(a.socks) // :28:7: error: 'Animal' does not have a member named 'socks'
  </code></pre>
  
  <p>How can I initially set a variable as a base class and turn it into it's subclass and access properties of said subclass?</p>