Найти причину ошибки - C#
Формулировка задачи:
Подскажите пожалуйста, почему мне выявляет ошибку на [ student b = new student ("alex" , 4 , false);] ???
Листинг программы
- using System;
- using System.Collections.Generic;
- namespace test2
- {
- public class student{
- public string name;
- public int klass;
- public bool scholarship;
- public void year (){
- name = "Chris";
- klass = 3;
- scholarship = true;
- }
- public void year (string name,int klass,bool scholarship)
- {
- this.name = name;
- this.klass= klass;
- this.scholarship = scholarship;
- }
- public void print (){
- Console.WriteLine ("The name of person is :" + name);
- Console.WriteLine ("This person is in the сlass :" +klass);
- Console.WriteLine ("Scholarship :" + scholarship );
- }
- }
- class MainClass
- {
- public static void Main (string[] args)
- {
- student a = new student ();
- a.print ();
- student b = new student ("alex" , 4 , false);
- b.print ();
- }
- }
- }
Решение задачи: «Найти причину ошибки»
textual
Листинг программы
- public void year (string name,int klass,bool scholarship)
- {
- this.name = name;
- this.klass= klass;
- this.scholarship = scholarship;
- }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д