Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
// Klasa zwierząt // Kury // Krowy public abstract class Animal { public virtual void Eat() { Console.WriteLine("Zwierze je"); } public abstract void TakeSound(); } public class Cow : Animal { public override void TakeSound() { System.Console.WriteLine("Krowa robi muuu"); } public override void Eat() { System.Console.WriteLine("Krowa je trawę"); } } public class Hen : Animal, IFly { public void Fly() { System.Console.WriteLine("kura lata"); } public override void TakeSound() { System.Console.WriteLine("kura robi ko ko"); } } public class Program { public static void Main() { Animal[] animals = new Animal[4]; Cow mucka = new Cow(); Cow klarabella = new Cow(); Hen kwoka = new Hen(); Hen hen1 = new Hen(); animals[0] = mucka; animals[1] = klarabella; animals[2] = kwoka; animals[3] = hen1; foreach (var animal in animals) { animal.TakeSound(); animal.Eat(); if (animal is IFly fly) { fly.Fly(); } } } } public interface IFly { void Fly(); } //Osoba //Uczeń // Nauczyciel //Trener // wykonaj ćwiczenie() wykonaj ćwiczenie() // PanStefan : Nauczyciel, Trener // panStefan.wykonaj ćwiczenie() //Interface
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)