Why is my C# constructor not working with the method I'm trying to use? -


maybe i've misunderstood how constructors work, in case, i'm trying create array , populate in constructor.

i have following code --

class clsdeck {     private string[] deck = new string[52];     private string[] hand = new string[12];     builddeck()     {         //lots of code assigning images each individual element of "deck" array.     }      //many other methods need called form. } 

visual studio 2012 insists method have return type. have added "void" builddeck method, , error disappeared, every example i've seen of constructor has have same name class, , has been method in class.

that won't compile. builddeck() has no return type. constructor names need match class name (including case). replace builddeck clsdeck().


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -