title: Up casting and down casting confusion in Swift?
body: <pre><code>class Media {
      var name :String = ""
      init(name:String) {
          self.name = name
      }
  }
  
  class Song:Media {}
  
  class Movie:Media{}
  
  let s1 = Song(name :"Fireproof")
  var m1 :Media = s1 //upcasting
  
  //var s2 :Song = m1
  var s2:Song = m1 as Song //down casting
  
  // var x1 :Movie = m1 as Movie //
  </code></pre>
  
  <ol>
  <li><p>On the line <code>var m1: Media = s1</code> you can set <code>m1</code> equal to <code>s1</code> because <code>m1</code>'s type is the superclass of <code>s1</code>??</p></li>
  <li><p>On line <code>var s2: Song = m1 as Song</code> , it is supposedly "down casting", is that because <code>m1: Media</code> and you are "casting" it "as" a <code>Song</code> type in order to match the same type of <code>s2</code>? (If this is true, then why did we set <code>m1</code> = <code>s1</code> earlier, when <code>s1</code> had a different type than <code>m1</code>??)</p></li>
  <li><p>What's the point of all this up casting and down casting? I've read the apple documentation and managed to confuse myself even more :'( </p></li>
  </ol>