title: Class programming approach for child/parent relationship
body: <p>I'm developing a program that scrapes content from various online archives, but am new to OOP. The way I believe would work best would be to have a parent class that specifies the shared variables and methods, then a child class for each archive which then contains the specific methods for grabbing info from that particular site, such as GrabStoryVariables() existing in each child class to accommodate the individual needs of that archive. The program takes a URL in a textbox, and then from there it will determine using the URL which child class to instantiate. </p>
  
  <p>The problem I'm having is figuring out how to create the child class object and make it accessible to the entire program. For example, to create an instance of FanFictionAuthors : FanBook:</p>
  
  <pre><code>private void btnGetInfo(object sender, EventArgs e)
  {
    CreateBook();
  }
  
  private void CreateBook()
  {
    if (addressBar.Text.Contains("fanficauthors.net"))
    {
      FanFictionAuthors myBook = new FanFictionAuthors();
    }
    return;
  }
  </code></pre>
  
  <p>The scope of myBook is just the CreateBook() function, so this approach won't do the trick. Any suggestions on the best way to handle this issue? I'm using this as an approach to better learn programming, so the "correct" way is what I'm trying to figure out, whatever that is. </p>
  
  <p>Edit: The specific function of the program is to take a provided URL for an online story from fanfiction.net, fictionpress.com, or one of any number of other online story archives. There are a set of shared attributes each story will have, such as title, number of chapters, length in words, chapter titles, and the actual content of the story. The program compiles all of this to create a single html document (later to be expanded to allow for different ebook formats) rather than a bunch of small individual chapter files.</p>
  
  <p>With that in mind, the only parts that should differ between each archive are the methods for grabbing the variables from the particular archive and how to iterate between the chapters based on the archive's function for that.</p>
  
  <p>Currently what I'm doing is just creating a myBook object immediately upon launching the main form, then creating a different method name for the functions that grab the variables and do the iteration. As I add more archives, however, this becomes more complicated. What I originally wanted to do was to just cast the myBook to the individual archive types (FanFictionAuthors in this case) to grab the ability to use their specific functions. Looking online, it appears casting from parent to child isn't easy nor recommended, so I'm not sure how else to approach this.</p>
  
  <p>Here's the GitHub link for the project. This version is slightly out of date, but lets you see how I'm currently approaching this: <a href="https://github.com/benroth/fBook" rel="nofollow">https://github.com/benroth/fBook</a></p>