官术网_书友最值得收藏!

Adding a virtual function

Now, in the next stage, we will add a virtual function called Perimeter. For this, enter the following beneath the closed curly brace:

public virtual string Perimeter()

Again, we'll centralize as much as we can. So, enter the following within a set of curly braces below this line:

return $"The perimeter of {name} is ";

The specific name can come from this line, because the name instance variable is declared above in private string name. However, the Perimeter will come from the derived classes.

So now, enter the following beneath the preceding closed curly brace:

public class Square : Quad
主站蜘蛛池模板: 陇川县| 玛沁县| 阿拉善右旗| 淅川县| 偃师市| 房山区| 新乡市| 犍为县| 柳河县| 枣庄市| 大足县| 军事| 肇州县| 曲阜市| 永顺县| 宜川县| 曲沃县| 进贤县| 饶河县| 绥芬河市| 阿勒泰市| 离岛区| 西乡县| 宁南县| 华容县| 孝义市| 井陉县| 南华县| 云浮市| 连州市| 广宁县| 富阳市| 固阳县| 来凤县| 伊通| 玉林市| 中卫市| 新田县| 西藏| 新乡县| 惠州市|