If we have only a parameterized constructor in class then why we can not create the object with default constructor? as before adding the parameterized constructor, there was no default constructor present in class! still, an instance of lass can be created by default constructor. But after adding parameterized constructor the default constructor stop working. WHY?
can anyone explain?
class Program
{
static void Main(string[] args)
{
Test test = new Test(); //instance created using parameterized constructor
Test2 test = new Test2(); //instance can not be created using default constructor
}
class Test
{
//no constructor present
}
class Test2
{
public Test2(int a)
{
//parameterized constructor present
}
}
}