- Beginning C# 7 Hands-On:Advanced Language Features
- Tom Owsiak
- 104字
- 2021-07-02 15:29:19
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
推薦閱讀
- SPSS數(shù)據(jù)挖掘與案例分析應用實踐
- Computer Vision for the Web
- Java程序員面試算法寶典
- aelf區(qū)塊鏈應用架構(gòu)指南
- PLC編程及應用實戰(zhàn)
- Python機器學習經(jīng)典實例
- 學習OpenCV 4:基于Python的算法實戰(zhàn)
- Multithreading in C# 5.0 Cookbook
- Android Wear Projects
- 用案例學Java Web整合開發(fā)
- Cocos2d-x Game Development Blueprints
- Beginning C++ Game Programming
- Android嵌入式系統(tǒng)程序開發(fā):基于Cortex-A8(第2版)
- Nagios Core Administration Cookbook(Second Edition)
- 計算機應用基礎項目化教程