/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
samples/snippets/csharp/versioning/override/Program.cs
31 строка
632 B
Andy De George
Move snippets from samples repo to this repo (#17296)
03 мар 2020, 19:23
Не верифицирован
03 мар 2020, 19:23
dbbeda1
Код
Авторство
О чём код?
using System; class Program { #region sample public class MyBaseClass { public virtual string MethodOne() { return "Method One"; } } public class MyDerivedClass : MyBaseClass { public override string MethodOne() { return "Derived Method One"; } } public static void Main() { MyBaseClass b = new MyBaseClass(); MyDerivedClass d = new MyDerivedClass(); Console.WriteLine("Base Method One: {0}", b.MethodOne()); Console.WriteLine("Derived Method One: {0}", d.MethodOne()); } #endregion }