计算属性
void main(){
print("主方法被执行了...");
_Rectangle mRectangle = _Rectangle();
mRectangle.width = 10;
mRectangle.height = 20;
print("矩形的面积 == ${mRectangle.area}");
mRectangle.area = 300;
}
class _Rectangle {
num width, height;
num get area {
return width * height;
}
set area(value){
width = value / height;
print("设置完面积后的宽度 == $width");
}
}