- 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
推薦閱讀
- Implementing VMware Horizon 7(Second Edition)
- Beginning Java Data Structures and Algorithms
- Android Development with Kotlin
- C語言程序設計
- TypeScript項目開發實戰
- 微信小程序項目開發實戰
- C語言程序設計教程
- Creating Stunning Dashboards with QlikView
- Java程序設計案例教程
- R語言數據可視化:科技圖表繪制
- Java 9 Programming By Example
- Go語言從入門到精通
- Learning GraphQL and Relay
- Building E-Commerce Solutions with WooCommerce(Second Edition)
- Learning jqPlot