TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Steffon Scott
NA
20
12.5k
Passing enumeration, invalid argument?
Apr 5 2013 1:48 AM
I have a constructor which is taking a enumeration argument to determine the properties of the instantiated object:
public Support(playerClass playerClass)
{
if (playerClass == playerClass.Fighter)
{
name = "Soldier";
ambush = 0;
attack = 4;
copper = 0;
defend = 4;
range = 0;
food = 1;
mode = 0;
numattacks = 1;
regen = 0;
shield = 0;
swarm = 1;
train = 0;
firstStrike = false;
type = 2;
}
}
Now when I call this constructor and pass the argument I am getting an invalid argument error from VS.
case "soldier":
while (count >= 1)
{
units.Add(new Support(playerClass));
count--;
}
break;
Any ideas? From my understanding I AM passing the enumeration argument it should be expecting? Any help would be appreciated, thanks.
Edit: Also, here is the signature of the addUnit method:
public void addUnit(int amount, string type, playerClass playerClass)
Reply
Answers (
3
)
sql insert command
If i enter Id in textbox1 then name should fill in textbox2