У нас вы можете посмотреть бесплатно C# interfaces 🐟 или скачать в максимальном доступном качестве, которое было загружено на ютуб. Для скачивания выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса savevideohd.ru
C# interfaces tutorial example explained #C# #interfaces #interface using System; namespace MyFirstProgram { class Program { static void Main(string[] args) { // interface = defines a "contract" that all the classes inheriting from should follow // An interface declares "what a class should have" // An inheriting class defines "how it should do it" // benefits = security + multiple inheritance + "plug-and-play" Rabbit rabbit = new Rabbit(); Hawk hawk = new Hawk(); Fish fish = new Fish(); rabbit.Flee(); hawk.Hunt(); fish.Flee(); fish.Hunt(); Console.ReadKey(); } interface IPrey { void Flee(); } interface IPredator { void Hunt(); } class Rabbit : IPrey { public void Flee() { Console.WriteLine("The rabbit runs away!"); } } class Hawk : IPredator { public void Hunt() { Console.WriteLine("The hawk is searching for food!"); } } class Fish : IPrey, IPredator { public void Flee() { Console.WriteLine("The fish swims away!"); } public void Hunt() { Console.WriteLine("The fish is searching for smaller fish!"); } } } }