Instantiating classes with identical properties and methods
<p>I have 2 classes that manage the operation of 2 different brands of net cam, each have exactly the same public members, but very different private members. One or the other of them is docked inside of a Pane class ( which type is decided at run time). The Pane class provides additional display functionality plus control of whichever camera is docked.  When an application instantiates the Pane class, and specifies the type of camera is to be docked, I would like to have the Pane instantiate the proper camera class so that it can call on that class.</p>

<p>My issue is illustrated in the last line of this example code...  camera doesn't have a .Start() method because camera is of type Object not of one of the two CameraType types.</p>

<p>How do I get 'object camera' to expose at design time the members of the assigned class so that Pane.Start() winds up calling the Start() method of the class assigned in the switch/case block?</p>

<p>Thank you for your time,
Dave</p>

<pre><code>public class CameraType1  //not to be used directly
{
    public CameraType1()
    {
        Stuff specific to this type of camera
    }

    public void Start()
    {
        // Stuff specific to starting a stream to this type
    }
}

public class CameraType2  //not to be used directly
{
    public CameraType2()
    {
        // Stuff specific to this type of camera
    }

    public void Start()
    {
        // Stuff specific to starting a stream to this type
    }
}

public class Pane
{
    object camera;

    public Pane(string CameraTypeToDeploy)
    {
        switch (CameraTypeToDeploy)
        {
            case "Type1":
                camera = new CameraType1();
                break;
            case "Type2":
                camera = new CameraType2();
                break;
        }
    }

    public void Start()
    {
        camera.Start();   //wrong... camera doesn't have a Start() method
    }
}
</code></pre>
