object.scp

来自「一个脚本语言的解释器」· SCP 代码 · 共 24 行

SCP
24
字号
object student(id, nm, sp, grd)
{
	ID = id;
	name = nm;
	specialty = sp;
	grade = grd;
	introduce = function()
	{
		println("I'm ",this.name, 
				" a ", this.grade, " of this university, ",
				"specialty in ", this.specialty, ", ",
				"student no. ", this.ID, "," ,
				"nice to meet you!");
	};
}

function main()
{
	s = new student("123456789", "Franklin Charlie", "computer science", "freshman");
	s.introduce();
	println(s);
	println(s.type());
	println(s.string());
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?