Projektdateien hinzufügen.

This commit is contained in:
2023-03-23 12:24:40 +01:00
parent 5fe92f4f47
commit 33e49f846c
51 changed files with 1444 additions and 0 deletions

View 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>

31
BeispielStatic/Program.cs Normal file
View File

@@ -0,0 +1,31 @@
namespace BeispielStatic
{
internal class Program
{
static void Main(string[] args)
{
Auto a1 = new Auto("Fiat", "500");
Auto a2 = new Auto("Ford", "Fiesta");
int anzahl = Auto.GetAnzahl();
Console.WriteLine(anzahl);
Console.WriteLine(a1.GetAnzahl2());
Console.WriteLine(a2.GetAnzahl2());
}
class Auto
{
private string marke;
private string modell;
private static int anzahl;
public Auto(string marke, string modell)
{
this.marke = marke;
this.modell = modell;
anzahl = anzahl + 1;
}
public static int GetAnzahl() { return anzahl; }
public int GetAnzahl2() { return anzahl; }
}
}
}