1
Answer

using constructors

Ask a question
chaithanya

chaithanya

16y
2.2k
1
I have a doubt in creating constructors
I have a program below
class classname
{
public void classname()        \\constructor
{
Console.WriteLine("Hai");
}
public static void Main(string[] args)
{
classname obj=new classname();
}
}
while executing this it gives an error method should not have same name classname
what is reason  and what is the solution for this?


Answers (1)