Maha

Maha

  • NA
  • 0
  • 324.8k

NP44 constructor

Sep 25 2007 7:49 AM

Hi Guys

 

NP44   constructor

 

C# Corner article website address is given below. I wish to know what is the purpose of having public Shape() constructor in the Shape class. Because program is working well without this constructor. Please anyone knows explain.  

 

http://www.c-sharpcorner.com/UploadFile/pcurnow/polymorphcasting06222007131659PM/polymorphcasting.aspx

 

Thank you

 

public class Shape

{

    protected int m_xpos;

    protected int m_ypos;

 

    /*

    public Shape()

    {

    }

    */

    public Shape(int x, int y)

    {

        m_xpos = x;

        m_ypos = y;

    }

    public virtual void Draw()

    {

        Console.WriteLine("Drawing a SHAPE at {0},{1}", m_xpos, m_ypos);

    }

}


Answers (2)