namespace OopConcept
{
///
/// Class without explicit contructor
///
class mainClass
{
private int m_int;
static void Main(string[] args)
{
//*******>No error*******
mainClass myMainClass = new mainClass();
}
}
}
But when we create a parametrized constructor the default constructor will be removed..
class mainClass
{
private int m_int;
///
/// Parametrized contructor created by the user.
///
///
public mainClass(int num)
{
this.m_int = num;
}
static void Main(string[] args)
{
//*******ERROR********
mainClass myMainClass = new mainClass();
}
}
0 comments:
Post a Comment