Process is terminated due to StackOverflowException.
为什么运行的时候会有这个提示:
Process is terminated due to StackOverflowException.
代码如下:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Student student1 = new Student();
student1.Score = 100;
Console.Write("最后得分是:" + student1.Score);
}
}
class Student
{
private string name;
private int _score;
public int Score
{
get { return _score; }
set { Score = value; }
}
}
}