Created
December 22, 2019 03:11
-
-
Save wantedfast/4a64aebd32e5a86d8ad522dea73d8d0f to your computer and use it in GitHub Desktop.
C#Base关键字
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Base关键字和This关键字略像,Base主要是用于: | |
| - 无序列表从子类访问父类重写的函数 | |
| - 无序列表调用父类的构造函数 | |
| ``` | |
| Public class House : Asset | |
| { | |
| ... | |
| public override int a => base.c + 3; | |
| } | |
| ``` | |
| 这种写法一定可以保证a能访问到Asset的属性,无论该属性是被重写还是隐藏了 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment