- Home /
WHY SAYS ME THAT IS AN ERROR?
I have been watching burgzerg arcade tutorial #17 :http://www.youtube.com/watch?v=xBELb3ollhQ&list=SPE5C2870574BF4B06 and i make exactly that he wanted to do, but the console is saying to me error CS0542: `Skill.Skill()': member names cannot be the same as their enclosing type and in the video he puts the script exactly like me but he hasn´t got the error, PLEASE CHECK MY SCRIPT TO SEE WHY I HAVE THE ERROR.
public class Skill : ModifiedStat { private bool _known;
public void Skill() {
_known= false;
ExpToLevel = 25;
LevelModifier = 1.1f;
}
public bool Known {
get{ return _known; }
set{ _known = value; }
}
}
public enum PoderName { Melee_Offence, Melee_Defence, Ranged_Offence, Range_Defence, Magic_Offence, Magic_Defence, }
Answer by RudyTheDev · Jan 05, 2014 at 08:09 PM
It's exactly what the error says -- "member names cannot be the same as their enclosing type". You cannot have a function named Skill()
in a class named Skill
.
Unless it is a constructor (which looks like is what you want), in which case it cannot have a return type, it has to be just public Skill() { ...
Your answer
Follow this Question
Related Questions
Getting index of the smallest number in a list 1 Answer
NullReferenceException problem 2 Answers
Particle circle HELP 1 Answer
Missing Reference FPS help 1 Answer
Null in GetValidMethodInfo 0 Answers