You are on page 1of 1

‫ מחלקות‬- ‫דף נוסחאות‬

public class Player


{
private string name, position;
private int score; ‫הגדרת התכונות‬

public Player(string name, string position, int score)


{
this.name = name; ‫פעולה בונה‬
this.position = position;
this.score = score;
}

public Player()
{
‫פעולה בונה ריקה‬
}

public Player(Player other)


{
name = other.name;
position = other.position; ‫פעולה מעתיקה‬
score = other.score;
}

public int GetScore()


{
return score; ‫פעולה מאחזרת‬
}

public bool SetScore(int score)


{
this.score = score;
return true; ‫פעולה קובעת‬
}

public bool AddScore(int score)


{
this.score += score;
return true; ‫פעולה‬
}

public override string ToString()


{
return name + " " + position + " " + score; ‫פעולת תיאור‬
} ‫העצם‬

You might also like