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

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
主站蜘蛛池模板: 望奎县| 高碑店市| 开原市| 增城市| 涪陵区| 台北市| 新和县| 岳普湖县| 九寨沟县| 苏州市| 闻喜县| 辽宁省| 纳雍县| 保亭| 新乡县| 炉霍县| 镇平县| 仙游县| 湟中县| 沐川县| 通城县| 宁化县| 镇康县| 台州市| 青神县| 靖宇县| 巴彦县| 洛隆县| 齐河县| 合阳县| 大英县| 灵丘县| 嘉荫县| 开封县| 耒阳市| 涟源市| 白水县| 五峰| 阳高县| 三台县| 莲花县|