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

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
主站蜘蛛池模板: 昌黎县| 连山| 玉林市| 庆云县| 舞阳县| 呼和浩特市| 高淳县| 晋州市| 平利县| 龙川县| 会昌县| 吴桥县| 定结县| 四会市| 拜泉县| 开江县| 乐陵市| 威远县| 九江县| 甘谷县| 嵩明县| 江西省| 资兴市| 米林县| 铜川市| 昌平区| 平谷区| 乌恰县| 崇文区| 建平县| 郓城县| 宁津县| 连州市| 老河口市| 宜宾县| 怀宁县| 鄂托克旗| 金湖县| 永康市| 上栗县| 昭通市|