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>

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeispielAssoziation
{
internal class Class
{
private Room room;
private string name;
public Class(string name)
{
this.name = name;
}
public string GetName() { return name; }
public void SetRoom(Room room)
{
this.room = room;
this.room.SetClass(this);
}
public void PrintInfos()
{
Console.WriteLine($"Diese Klasse ist im Raum {room.Get_Name()}.");
}
}
}

View File

@@ -0,0 +1,22 @@
namespace BeispielAssoziation
{
internal class Program
{
static void Main(string[] args)
{
Class oop = new Class("OOP");
Class sql = new Class("SQL");
Room r1 = new Room("1");
Room r2 = new Room("2");
oop.SetRoom(r1);
sql.SetRoom(r2);
oop.PrintInfos();
sql.PrintInfos();
r1.PrintInfos();
r2.PrintInfos();
}
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeispielAssoziation
{
internal class Room
{
private Class _class;
private string _name;
public Room(string name)
{
this._name = name;
}
public string Get_Name() { return _name; }
public void SetClass(Class _class)
{
this._class = _class;
}
public void PrintInfos()
{
Console.WriteLine($"In diesem Raum ist die Klasse {_class.GetName()}.");
}
}
}