title: Inherit parent factory method
body: <p>I have class A and its child class B which inherits from A.</p>
  
  <p>Now, I have a class method in A which takes the instance from somewhere with "inout" and checks if it is nil, if not it fills it with necessary parameters. For example:</p>
  
  <pre><code>class A
  {
      class func fillInstance(inout instance : Self, parameters : [String]) -&gt; Self
      {
            guard let instance = instance else
           {
               return Self(parameters : parameters)
           }
  
           return instance
      }
  }
  </code></pre>
  
  <p>Now, of course nothing which has Self there is not valid :) </p>
  
  <p>I need a way to make it valid. Is it possible in Swift? </p>
  
  <p>Everything here is fiction. I just need to be able to implement the idea of a class method which can be inherited by a child and which would allow instantiating an instance according to the class that called that class method. I don't want to check for the type because it can be inherited down the child hierarchy a lot of times (I mean it can become A -> B -> C -> D -> E.... and all inherit one from another). Please help :)</p>