I'm having a horrible time figuring out how to create and use classes in C#. I have some experience in Python, where flat out everything is incomparably simpler.
Here's a class I'm trying to make for a character in my game:\
I don't understand the "get/set" part, or really anything else either.
I want the user to create his character, called player, which will assign those values to the character object.
Thanks for the help!
-Sharpe
Here's a class I'm trying to make for a character in my game:\
namespace ConsoleApplication1
{
class Character
{
private string name;
private int strength, attack, hitPoints;
public Character(string name, int strength, int attack, int hitPoints)
{
this.name = name;
this.strength = strength;
this.attack = attack;
this.hitPoints = hitPoints;
}
public string Name
{
get { return name; }
set { name = value; }
}
}
}I don't understand the "get/set" part, or really anything else either.
I want the user to create his character, called player, which will assign those values to the character object.
Thanks for the help!
-Sharpe