-
Apr 17th, 2006, 05:24 PM
#1
Thread Starter
Hyperactive Member
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
-
Apr 17th, 2006, 05:28 PM
#2
Re: constructor
Constructors don't have a return type. It would just be...
Code:
public Form1() {
//...
}
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Apr 17th, 2006, 05:31 PM
#3
Thread Starter
Hyperactive Member
Re: constructor
but the error message is different .
-
Apr 17th, 2006, 05:33 PM
#4
Re: constructor
Okay...and what would it be?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Apr 17th, 2006, 05:42 PM
#5
Thread Starter
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|