-
constructor
I read that every class can have a constructor (or multiple constructors ).
I have a form1 class and this is the start up form.
I want to try and see how the constructor for his object works, and I added the following code.
public class Form1 : System.Windows.Forms.Form
{
public void Form1()
{
Console.WriteLine("Constructor");
}
}
static void Main()
{
Application.Run(new Form1());
}
Error: Member names cannot be same as the member types
what does that mean?
nath
-
Re: constructor
Constructors don't have a return type. It would just be...
Code:
public Form1() {
//...
}
-
Re: constructor
but the error message is different .
-
Re: constructor
Okay...and what would it be?
-
Re: constructor