Very basic exercise in Virtual functions
<p>Alright, so here's the exercise:
You must define three classes. One class named MyNum that contains a variable of type int. Second class called MyString, will be derived from MyNum and contains string. Third-class call MyType and returns a variable of type MyNum. Each class will be set to a constructor function and virtual function called Show. The constructor function of MyType receive a MyNum variable, whereas the function Show of MyType will run the Show function of MyNum.
Now, you need set two objects of type MyType and initialize them. Once an object type MyNum and once an object of type MyString.</p>

<p>Here's the code:</p>

<pre><code>class MyNum
{
    protected int num;
    public MyNum(int num)
    {
        this.num = num;
    }
    public virtual void Show()
    {
        Console.WriteLine("The number is : " + num);
    }
}
class MyString : MyNum
{
    string str;
    public MyString(string str)
    {
        this.str= str;
    }
}
class MyType : MyNum
{
    MyNum num2;
    public MyType(MyNum num)
    {
        this.num2 = num;
    }
    public override void Show()
    {
        base.Show();
    }
}
class Program
{
    static void Main(string[] args)
    {

    }
}
</code></pre>

<p>I'm having the following error:</p>

<p>Error   1   'ConsoleApplication1.MyNum' does not contain a constructor that takes '0' arguments C:\Users\x\AppData\Local\Temporary Projects\ConsoleApplication1\Program.cs  23  16  ConsoleApplication1</p>

<p>Anyone knows why am I having this error? Thanks.</p>
