title: Access class property from instance?
body: <p>I am not sure is this is correct behaviour or if its unintended. I have setup <code>StealthFighter</code> so that it returns a class type computed property variable called <code>ammunition</code>.</p>
  
  <pre><code>func globalTests() {
      println("globalTests")
      println("AMMUNITION: \(StealthFighter.ammunition)")
      var myStealthFighter = StealthFighter()
      println("MISSILES: \(myStealthFighter.missiles)")
      println("AMMUNITION: \(myStealthFighter.ammunition)") // ERROR
  }
  
  class StealthFighter {
      class var ammunition:Int {
      return 500;
      }
      var missiles: Int = 5
  }
  </code></pre>
  
  <p>When directly accessing the class <code>StealthFighter</code> this works fine and returns 500 as expected. But if I create and instance <code>myStealthFighter</code> and then try and access the class property on the instance I get the error: <code>'StealthFighter' does not have a member named 'ammunition'</code> I can't find any mention of this, I am assuming from this that class properties are accessible only via the class? and not on any instances created from it? I just want to make sure I am understanding this correctly ...</p>
  
  <h1>EDIT:</h1>
  
  <p>So I have probably worded the type variable name wrong as it should probably be <code>maxAmmunition</code> to signify that <code>StealthFighters</code> can only take 500 rounds. I can see the point, if you want the <code>maxAmmunition</code> for the class then you ask the class. </p>
  
  <p>As @Kreiri and @0x7fffffff points out it does seem that you can ask the instance what the class ammunition (or maxAmmunition) is by using dynamicType.</p>
  
  <pre><code>println("CLASS - AMMUNITION: \(StealthFighter.ammunition)")
  var myStealthFighter = StealthFighter()
  println("INSTA - AMMUNITION: \(myStealthFighter.dynamicType.ammunition)")
  </code></pre>
  
  <p>.</p>
  
  <pre><code>// OUTPUT
  // CLASS - AMMUNITION: 500
  // INSTA - AMMUNITION: 500
  </code></pre>