Process is terminated due to StackOverflowException - C# (188195)
Формулировка задачи:
При компиляции получаю эту ошибку в консоли. Что не так? Откуда переполнение стека?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Деньги
{
class Program
{
static void Main(string[] args)
{
Money m = new Money(10, 15);
double s = m.TransferCost(5);
Console.WriteLine("Полная стоимость {0}", s.ToString());
}
}
class Money
{
public int rub { get; set; }
public int kop
{
get { return kop; }
set
{
if (value > 99) { Console.WriteLine("Копеек не может быть более 99!!!"); }
else { kop = value; }
}
}
//Конструкторы
public Money() { }
public Money(int rub, int kop)
{
this.rub = rub;
this.kop = kop;
}
//Методы
public double TransferCost(double commision)
{
double summa = rub * 100 + kop;
summa += commision * summa / 100;
return summa;
}
}
}Решение задачи: «Process is terminated due to StackOverflowException»
textual
Листинг программы
else { kop = value; }