erweiterung
This commit is contained in:
20
BeispielInterfaces/AmphibienFahrzeug.cs
Normal file
20
BeispielInterfaces/AmphibienFahrzeug.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeispielInterfaces
|
||||
{
|
||||
internal class AmphibienFahrzeug : IFahren, ISchwimmen
|
||||
{
|
||||
public void Fahren()
|
||||
{
|
||||
Console.WriteLine("Das Amphibienfahrzeug fährt.");
|
||||
}
|
||||
public void Schwimmen()
|
||||
{
|
||||
Console.WriteLine("Das Amphibienfahrzeug schwimmt.");
|
||||
}
|
||||
}
|
||||
}
|
||||
17
BeispielInterfaces/Auto.cs
Normal file
17
BeispielInterfaces/Auto.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeispielInterfaces
|
||||
{
|
||||
internal class Auto : IFahren
|
||||
{
|
||||
public void Fahren()
|
||||
{
|
||||
Console.WriteLine("Das Auto fährt");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
10
BeispielInterfaces/BeispielInterfaces.csproj
Normal file
10
BeispielInterfaces/BeispielInterfaces.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
16
BeispielInterfaces/Boot.cs
Normal file
16
BeispielInterfaces/Boot.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeispielInterfaces
|
||||
{
|
||||
internal class Boot : ISchwimmen
|
||||
{
|
||||
public void Schwimmen()
|
||||
{
|
||||
Console.WriteLine("Das Boot schwimmt.");
|
||||
}
|
||||
}
|
||||
}
|
||||
13
BeispielInterfaces/IFahren.cs
Normal file
13
BeispielInterfaces/IFahren.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeispielInterfaces
|
||||
{
|
||||
interface IFahren
|
||||
{
|
||||
public void Fahren();
|
||||
}
|
||||
}
|
||||
13
BeispielInterfaces/ISchwimmen.cs
Normal file
13
BeispielInterfaces/ISchwimmen.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BeispielInterfaces
|
||||
{
|
||||
interface ISchwimmen
|
||||
{
|
||||
public void Schwimmen();
|
||||
}
|
||||
}
|
||||
16
BeispielInterfaces/Program.cs
Normal file
16
BeispielInterfaces/Program.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace BeispielInterfaces
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
IrgendwasMitFahren(new Auto());
|
||||
IrgendwasMitFahren(new AmphibienFahrzeug());
|
||||
}
|
||||
static void IrgendwasMitFahren(IFahren fahren)
|
||||
{
|
||||
Console.WriteLine("Diese Mehtode benötigt etwas das fahren kann.");
|
||||
fahren.Fahren();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user