Hello, i would like to know how to instantiate an object using private constructor? and what are the main benefits to use private constructor?
namespace Practice
{
public class Test
{
int a;
public Test()
{
}
private Test(int a)
{
this.a = a;
}
}
public class Test2
{
void method()
{
Test obj1 = new Test();
}
}
}