I am trying to create a very simple CUser class in my project, but apparently I am doing something wrong. Here is the code:
using System;
using System.Collections;
开发者_如何学编程using System.Collections.Generic;
using System.Linq;
using System.Web;
using MySql.Data.MySqlClient;
namespace admin.NET.lib {
public class CUser {
protected MySqlConnection conn;
public void CUser() {
}
}
}
This simple piece of code gives me:
'CUser': member names cannot be the same as their enclosing type
Can anyone give me a hint to where I must modify this to work. I saw that this problem poped before but I could not adapt the solutions to my code.
Thanks
Remove the void
. Constructors have no return type.
Bad constructor. Read .net base information.
public CUser() { }
Would be better !
Your contructor returns a reference to the object it create, this is his job :-).
精彩评论