[AHK]面向对象–Box类

理解面向对象里面的成员属性,以及对成员属性赋值。geter,seter,this的用法

[AHK]面向对象--Box类

class Box {
	setColor(color) {
		this.color := color
		return this
	}

	setMaterial(material) {
		this.material := material
		return this
	}

	setWeight(weight) {
		this.weight := weight
		return this
	}

	printIt() {
		MsgBox, % "Color: " . this.color
		. "`r`n" . "Material: " . this.material
		. "`r`n" . "Weight: " . this.weight . " lbs"
	}
}

heavyRedWoodenBox := new Box()
				.setWeight(200)
				.setMaterial("Anodized Aluminum")
				.setColor("Red")
				.printIt()

给TA捐赠
共{{data.count}}人
人已捐赠
其他函数

[AHK]面向对象--窗口类

2023-1-12 18:55:33

教程

疑难杂症

2023-1-12 20:06:03

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
有新私信 私信列表
搜索