- 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
推薦閱讀
- The Complete Rust Programming Reference Guide
- C語言程序設(shè)計案例教程(第2版)
- Getting Started with SQL Server 2012 Cube Development
- 編譯系統(tǒng)透視:圖解編譯原理
- Reactive Android Programming
- Tableau 10 Bootcamp
- 零基礎(chǔ)學(xué)C語言第2版
- Geospatial Development By Example with Python
- CodeIgniter Web Application Blueprints
- Backbone.js Testing
- JavaScript語法簡明手冊
- Python深度學(xué)習(xí):基于PyTorch
- Visual Basic程序設(shè)計
- 狼書(卷2):Node.js Web應(yīng)用開發(fā)
- 亮劍ASP.NET項目開發(fā)案例導(dǎo)航