Какой функцией можно заменить все "this" - C#

Узнай цену своей работы

Формулировка задачи:

Подскажите, пожалуйста, какой функцией можно заменить все эти "this", чтобы не прописывать его для каждой переменной?
     public Sportsmen(string name, int age, int energy, int power, int gender, double height, double weight, string muscules)
        {
            this._name = name;
            this._age = age;
            this._energy = energy;
            this._power = power;
            this._gender = gender;
            this._height = height;
            this._weight = weight;
            this._muscles = muscules;

        }

Решение задачи: «Какой функцией можно заменить все "this"»

textual
Листинг программы
class Sportsmen
    {
        string name;
        int age;
        int energy;
        int power;
        int gender;
        double height;
        double weight;
        string muscles;
 
        public Sportsmen(string name, int age, int energy, int power, int gender, double height, double weight, string muscules)
        {
            this.name = name;
            this.age = age;
            this.energy = energy;
            this.power = power;
            this.gender = gender;
            this.height = height;
            this.weight = weight;
            this.muscles = muscules;

ИИ поможет Вам:


  • решить любую задачу по программированию
  • объяснить код
  • расставить комментарии в коде
  • и т.д
Попробуйте бесплатно

Оцени полезность:

10   голосов , оценка 3.6 из 5
Похожие ответы